diff --git a/app/build.gradle b/app/build.gradle index 6e23a319b..1168967bd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -25,12 +25,6 @@ apply plugin: "io.spring.dependency-management" group = "it.chalmers" version = "2.0.0-SNAPSHOT" -bootBuildImage { - environment = [ - 'JAVA_TOOL_OPTIONS': '-XX:MaxRAM=10g' - ] -} - dependencies { annotationProcessor( // Used to generate Record Builder classes diff --git a/app/src/main/java/it/chalmers/gamma/adapter/primary/web/ForgotPasswordController.java b/app/src/main/java/it/chalmers/gamma/adapter/primary/web/ForgotPasswordController.java index 753630f66..dd4953175 100644 --- a/app/src/main/java/it/chalmers/gamma/adapter/primary/web/ForgotPasswordController.java +++ b/app/src/main/java/it/chalmers/gamma/adapter/primary/web/ForgotPasswordController.java @@ -1,8 +1,11 @@ package it.chalmers.gamma.adapter.primary.web; +import static it.chalmers.gamma.adapter.primary.web.WebValidationHelper.validateObject; + import it.chalmers.gamma.app.common.Email.EmailValidator; import it.chalmers.gamma.app.user.domain.Cid.CidValidator; import it.chalmers.gamma.app.user.passwordreset.UserResetPasswordFacade; +import it.chalmers.gamma.app.user.passwordreset.domain.PasswordResetRepository; import it.chalmers.gamma.app.validation.FailedValidation; import it.chalmers.gamma.app.validation.SuccessfulValidation; import it.chalmers.gamma.app.validation.ValidationResult; @@ -16,8 +19,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; -import static it.chalmers.gamma.adapter.primary.web.WebValidationHelper.validateObject; - @Controller public class ForgotPasswordController { @@ -145,6 +146,12 @@ public ModelAndView finalizeForgotPassword( throw new RuntimeException(e); } catch (IllegalArgumentException e) { bindingResult.addError(new ObjectError("global", e.getMessage())); + } catch (PasswordResetRepository.TokenNotFoundRuntimeException e) { + bindingResult.addError( + new ObjectError("global", "Token has expired, please restart the reset flow.")); + } + + if (bindingResult.hasErrors()) { return createGetFinalizeForgotPassword( htmxRequest, new FinalizeForgotPassword(form.token, "", ""), bindingResult); }