Package org.tailormap.api.controller
Class PasswordResetController
java.lang.Object
org.tailormap.api.controller.PasswordResetController
@RestController
@Validated
@ConditionalOnProperty(name="tailormap-api.password-reset.enabled",
havingValue="true")
public class PasswordResetController
extends Object
-
Constructor Summary
ConstructorsConstructorDescriptionPasswordResetController
(org.springframework.mail.javamail.JavaMailSender emailSender, UserRepository userRepository, TemporaryTokenRepository temporaryTokenRepository, org.springframework.context.MessageSource messageSource, org.springframework.web.servlet.LocaleResolver localeResolver) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<Serializable> confirmPasswordReset
(@NotNull UUID token, @NotNull String username, @NotNull String newPassword) org.springframework.http.ResponseEntity
<?> handleException
(jakarta.validation.ConstraintViolationException e) org.springframework.http.ResponseEntity
<Serializable> requestPasswordReset
(@Email String email, jakarta.servlet.http.HttpServletRequest request) Request a password reset email.
-
Constructor Details
-
PasswordResetController
public PasswordResetController(org.springframework.mail.javamail.JavaMailSender emailSender, UserRepository userRepository, TemporaryTokenRepository temporaryTokenRepository, org.springframework.context.MessageSource messageSource, org.springframework.web.servlet.LocaleResolver localeResolver)
-
-
Method Details
-
handleException
@ExceptionHandler(jakarta.validation.ConstraintViolationException.class) public org.springframework.http.ResponseEntity<?> handleException(jakarta.validation.ConstraintViolationException e) -
requestPasswordReset
@PostMapping(path="${tailormap-api.base-path}/password-reset", produces="application/json", consumes="application/x-www-form-urlencoded") public org.springframework.http.ResponseEntity<Serializable> requestPasswordReset(@RequestParam @Email @Email String email, jakarta.servlet.http.HttpServletRequest request) throws jakarta.validation.ConstraintViolationException Request a password reset email. The email will be sent asynchronously.- Parameters:
email
- the email address to request a password reset for- Returns:
- 202 ACCEPTED with a message that the request is being processed
- Throws:
jakarta.validation.ConstraintViolationException
- when the email is not valid
-
confirmPasswordReset
@PostMapping(path="${tailormap-api.base-path}/user/reset-password", produces="application/json", consumes="application/x-www-form-urlencoded") @Transactional public org.springframework.http.ResponseEntity<Serializable> confirmPasswordReset(@NotNull @NotNull UUID token, @NotNull @NotNull String username, @NotNull @NotNull String newPassword) throws org.springframework.web.server.ResponseStatusException - Throws:
org.springframework.web.server.ResponseStatusException
-