Request Password Reset
Sends a password reset email to the user with a reset token. For security, this endpoint always returns success even if the email doesn’t exist.This endpoint has strict rate limiting: 5 requests per 15 minutes in production.
Request Body
User’s email address. Must be a valid email format.
Response
Generic success message that doesn’t reveal if the email exists.
Example Request
Example Response
Reset Password
Resets the user’s password using the token received via email.Request Body
The password reset token received in the reset email.
New password. Must be at least 8 characters long.
Response
Success message confirming the password was reset.
Error Responses
400 Bad Request
Returned when:- Token or password is missing or invalid type
- Password is less than 8 characters
- Token is invalid or not found in the database
- Token has expired (tokens expire after 1 hour)
500 Internal Server Error
Returned when:- Database query fails
- Password hashing fails
- User update fails
Example Request
Example Response
Error Response Examples
Invalid Token
Expired Token
Password Too Short
Implementation Details
- Reset tokens are stored as hashed values in the database for security
- Tokens expire 1 hour after generation (stricter than email verification)
- New passwords are hashed using bcrypt with a salt rounds of 10
- Upon successful reset:
- The password hash is updated
- The reset token and expiration date are cleared from the database
- For security, the request endpoint doesn’t reveal if an email exists in the system
Password Reset Flow
- User requests password reset by providing their email
- If the email exists, a reset token is generated and sent via email
- User clicks the link in the email (containing the token)
- User submits the token along with their new password
- Password is updated and user can log in with the new password