diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-core/src/main/java/io/gravitee/am/gateway/handler/root/RootProvider.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-core/src/main/java/io/gravitee/am/gateway/handler/root/RootProvider.java index 36d9d0bfec4..ac0cc1a7ccb 100644 --- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-core/src/main/java/io/gravitee/am/gateway/handler/root/RootProvider.java +++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-core/src/main/java/io/gravitee/am/gateway/handler/root/RootProvider.java @@ -378,7 +378,8 @@ protected void doStart() throws Exception { .handler(new RegisterConfirmationSubmissionEndpoint(userService)); // Forgot password route - Handler forgotPasswordAccessHandler = new ForgotPasswordAccessHandler(domain); + final var forgotPasswordAccessHandler = new ForgotPasswordAccessHandler(domain); + final var resetPasswordFailureHandler = new ErrorHandler(PATH_RESET_PASSWORD); rootRouter.route(HttpMethod.GET, PATH_FORGOT_PASSWORD) .handler(clientRequestParseHandler) .handler(forgotPasswordAccessHandler) @@ -403,6 +404,8 @@ protected void doStart() throws Exception { .handler(passwordPolicyRequestParseHandler) .handler(policyChainHandler.create(ExtensionPoint.POST_RESET_PASSWORD)) .handler(new ResetPasswordSubmissionEndpoint(userService)); + rootRouter.route(PATH_RESET_PASSWORD) + .failureHandler(resetPasswordFailureHandler); // error route rootRouter.route(HttpMethod.GET, PATH_ERROR) diff --git a/gravitee-am-policy/gravitee-am-policy-send-email/src/test/java/io/gravitee/am/policy/send/email/SendEmailPolicyTest.java b/gravitee-am-policy/gravitee-am-policy-send-email/src/test/java/io/gravitee/am/policy/send/email/SendEmailPolicyTest.java index 4b7fa49f976..347a3c64905 100644 --- a/gravitee-am-policy/gravitee-am-policy-send-email/src/test/java/io/gravitee/am/policy/send/email/SendEmailPolicyTest.java +++ b/gravitee-am-policy/gravitee-am-policy-send-email/src/test/java/io/gravitee/am/policy/send/email/SendEmailPolicyTest.java @@ -58,12 +58,12 @@ public class SendEmailPolicyTest { @Before public void init() { when(executionContext.getComponent(EmailService.class)).thenReturn(emailService); - when(configuration.getTemplate()).thenReturn("template"); - when(configuration.getSubject()).thenReturn("subject"); - when(configuration.getFrom()).thenReturn("from"); - when(configuration.getFromName()).thenReturn("fromName"); - when(configuration.getTo()).thenReturn("to"); - when(configuration.getContent()).thenReturn("content"); + lenient().when(configuration.getTemplate()).thenReturn("template"); + lenient().when(configuration.getSubject()).thenReturn("subject"); + lenient().when(configuration.getFrom()).thenReturn("from"); + lenient().when(configuration.getFromName()).thenReturn("fromName"); + lenient().when(configuration.getTo()).thenReturn("to"); + lenient().when(configuration.getContent()).thenReturn("content"); } @Test