Skip to content

feat: add password reset flow with rate limiting, single-use tokens, and expiry#721

Open
Xenon010101 wants to merge 1 commit into
imDarshanGK:mainfrom
Xenon010101:feat/password-reset
Open

feat: add password reset flow with rate limiting, single-use tokens, and expiry#721
Xenon010101 wants to merge 1 commit into
imDarshanGK:mainfrom
Xenon010101:feat/password-reset

Conversation

@Xenon010101
Copy link
Copy Markdown

Summary

Implements secure password reset functionality for the auth system:

  • POST /auth/forgot-password — generates a cryptographically secure reset token, stores it with an expiry date
  • POST /auth/reset-password — verifies the token, enforces single-use (used_at timestamp), and updates the password
  • Rate limiting — forgot-password is limited to 3 requests per 5-minute window per email to prevent abuse
  • Token expiry — configurable via RESET_TOKEN_EXPIRE_MINUTES env var (default 30 min)
  • One-time use — tokens are marked used_at on consumption, cannot be replayed

Closes #570

@Xenon010101 Xenon010101 requested a review from imDarshanGK as a code owner May 31, 2026 05:27
…and expiry

Implement forgot-password and reset-password endpoints:
- POST /auth/forgot-password generates a secure token with configurable TTL
- POST /auth/reset-password consumes the token (single-use) to change password
- Rate limiting (3 req / 5 min window) on forgot-password to prevent abuse
- Token expires after configurable minutes (default 30)
- PasswordResetToken model with used_at tracking for one-time use

Closes imDarshanGK#570
@Xenon010101 Xenon010101 force-pushed the feat/password-reset branch from d085061 to 399f3d7 Compare May 31, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden password reset flow and rate limit requests

1 participant