From e453e15a85e62e3b44f4b60e5961fe51dc4b5d56 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 14 Mar 2021 11:52:31 +0100 Subject: [PATCH] WIP --- .../demos/pwreset/adapters/in/WebController.java | 6 +++--- .../pwreset/api/domain/PasswordResetRequest.java | 4 ++++ .../pwreset/api/domain/PasswordRestService.java | 13 ++++++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/adapters/in/WebController.java b/pwreset/src/main/java/de/juplo/demos/pwreset/adapters/in/WebController.java index 79ad14e..b848ce2 100644 --- a/pwreset/src/main/java/de/juplo/demos/pwreset/adapters/in/WebController.java +++ b/pwreset/src/main/java/de/juplo/demos/pwreset/adapters/in/WebController.java @@ -32,14 +32,14 @@ public class WebController throws IOException { - PasswordResetRequest resetRequest = passwordRestService.requestPasswordReset(email); + PasswordResetRequest resetRequest = passwordRestService.request(email); httpServletResponse.sendRedirect(resetRequest.getUserId().toString()); } @GetMapping("/{id}") public ModelAndView getResetRequest(@PathVariable UUID id) { - PasswordResetRequest resetRequest = passwordRestService.getPasswordReset(id); + PasswordResetRequest resetRequest = passwordRestService.get(id); ModelAndView mav = new ModelAndView("confirm"); return "confirm"; } @@ -57,7 +57,7 @@ public class WebController try { PasswordResetRequest resetRequest = - passwordRestService.confirmPasswordRequest( + passwordRestService.confirm( id, code, password); diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequest.java b/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequest.java index a5508d8..d0ed22f 100644 --- a/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequest.java +++ b/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequest.java @@ -2,6 +2,7 @@ package de.juplo.demos.pwreset.api.domain; import lombok.Data; +import java.time.ZonedDateTime; import java.util.Optional; import java.util.UUID; @@ -21,4 +22,7 @@ public class PasswordResetRequest private String code; private String password; private Status status; + private ZonedDateTime created; + private ZonedDateTime confirmed; + private ZonedDateTime accomplihed; } diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordRestService.java b/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordRestService.java index af124c7..3eca306 100644 --- a/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordRestService.java +++ b/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordRestService.java @@ -5,7 +5,14 @@ import java.util.UUID; public interface PasswordRestService { - PasswordResetRequest requestPasswordReset(String email); - PasswordResetRequest getPasswordReset(); - PasswordResetRequest confirmPasswordRequest(UUID requestId, String code, String password); + enum Progress + { + CREATED, + CONFIRMED, + ACCOMPLISHED + } + + PasswordResetRequest request(String email); + PasswordResetRequest get(); + PasswordResetRequest confirm(UUID requestId, String code, String password); } -- 2.20.1