Skip to content

Commit

Permalink
fix: add failure handler for ResetPassword endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
leleueri committed May 4, 2022
1 parent f970da3 commit ed8aa14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,8 @@ protected void doStart() throws Exception {
.handler(new RegisterConfirmationSubmissionEndpoint(userService));

// Forgot password route
Handler<RoutingContext> 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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ed8aa14

Please sign in to comment.