Email-based password reset flow with expiry
Why Choose This Project?
Password recovery is one of the most common yet vulnerable features in web applications. Many insecure implementations allow attackers to reset user accounts using leaked links or replay attacks. This project ensures a secure, time-bound, tokenized password reset flow to protect users from account takeover attempts. Ideal for secure platforms like banking apps, e-commerce, and enterprise portals.
What You Get in This Project
A robust password reset system where users can:
-
Request a password reset by email
-
Receive a unique, one-time-use, time-expiring link
-
Reset their password only if the token is valid and not expired
-
Get alerts if suspicious reset requests are made
Technology Stack
| Layer | Technology |
|---|---|
| Frontend | HTML, CSS, JavaScript, Bootstrap (React optional for forms) |
| Backend | Node.js (Express) / Java Spring Boot / Python Django/Flask |
| Database | MySQL / PostgreSQL / MongoDB |
| Auth | JWT, Spring Security, or OAuth |
| Email Service | SMTP (SendGrid, Gmail SMTP, AWS SES, Postfix) |
| Security | BCrypt/Argon2 password hashing, HTTPS/TLS |
| Optional | Redis for temporary token storage, reCAPTCHA for request form |
Key Features
| Feature | Description |
|---|---|
| Password Reset Request | User enters registered email to request reset |
| Token Generation | Backend generates a random, cryptographically secure token |
| Expiry Mechanism | Token is valid for a short time (e.g., 15 mins – 1 hour) |
| One-Time Use | Token can only be used once; becomes invalid after reset |
| Email Delivery | Secure email with reset link sent to user |
| Reset Page | User clicks link → redirected to reset password form |
| Verification Flow | Backend verifies token, expiry, and user identity |
| Alerts & Logs | User notified if multiple reset attempts are made |
| Strong Password Enforcement | Password must meet strength requirements (symbols, numbers, length) |
How the Secure Password Reset Flow Works
-
User Requests Reset
→ User enters their email on “Forgot Password” page. -
Token Generation
→ Server generates a unique secure token and stores it (DB/Redis) with an expiry timestamp. -
Email Sent
→ User gets an email containing a reset link:https://example.com/reset-password?token=XYZ -
User Clicks Link
→ Server validates token:-
Exists?
-
Not expired?
-
Not used before?
-
-
Password Reset Form
→ User sets a new strong password. -
Update & Invalidate Token
→ Password updated (hashed) in DB.
→ Token marked as used or expired.
Security Features
-
Token Expiry → Prevents replay attacks by enforcing time-bound reset links.
-
One-Time Use → Tokens are invalidated immediately after use.
-
Email Security → Reset link contains cryptographically random, unguessable tokens.
-
Password Hashing → New passwords are stored only in hashed format (BCrypt/Argon2).
-
Brute-Force Protection → Lockout/reset attempt limits to prevent abuse.
-
User Alerts → Users receive notifications for password reset requests, even if they didn’t initiate them.
-
HTTPS/TLS → Reset links only work over encrypted HTTPS.