- Request password reset - Initiates the reset process
- Validate reset token - Verifies the token is valid
- Complete password reset - Sets the new password
PasswordResetController.java
POST /auth/forgot-password
Initiates the password reset process by sending a reset link to the user’s registered email address. Authentication: None required (public endpoint) Source:PasswordResetController.java:26
Request
Username or email address of the account to reset. The system will send a password reset link if this account exists.Note: For security reasons, the response is always successful regardless of whether the username exists.
Response
Always returns
trueConfirmation message: “Si el correo está registrado, recibirás en breve el enlace de recuperación. Puede tardar un momento.”
Example
Success Response
The response is intentionally vague to prevent username enumeration attacks. An email is only sent if the username exists in the system.
POST /auth/validate-reset-token
Validates that a password reset token is valid and not expired. Use this endpoint to verify a token before showing the password reset form. Authentication: None required (public endpoint) Source:PasswordResetController.java:36
Request
The password reset token received via email. This token is typically extracted from the reset link URL.
Response
Success (200 OK):Returns
true if the token is valid and not expiredReturns
false if the token is invalid or expiredError message explaining why the token is invalid
Example
Success Response
Error Response
POST /auth/reset-password
Completes the password reset process by setting a new password for the user account. Authentication: None required (token-based verification) Source:PasswordResetController.java:47
Request
The valid password reset token received via email
The new password to set for the user account. Should meet the application’s password complexity requirements.
Response
Success (200 OK):Success message: “Contraseña actualizada correctamente.”
Error message explaining why the password reset failed (e.g., invalid token, expired token, weak password)
Example
Success Response
Error Responses
Complete Password Reset Flow
Here’s how the three endpoints work together:User requests password reset
User enters their username/email on the forgot password page. Your application calls
POST /auth/forgot-password.User receives email
If the account exists, the user receives an email with a password reset link containing a token:
Validate the token
When the user clicks the link, your application extracts the token from the URL and calls
POST /auth/validate-reset-token to verify it’s valid before showing the password reset form.User sets new password
User enters their new password. Your application calls
POST /auth/reset-password with the token and new password.