Commit 199c042
Feat: Improve password reset workflow (#42)
* Add security notification email for password changes
When a user changes their password (while logged in), they now
receive a security alert email with details of the change.
Features:
1. Email Templates:
- password_changed_notification.html - Styled HTML email
- password_changed_notification.txt - Plain text version
- Includes timestamp, IP address, and user agent
- Clear instructions for compromised accounts
2. Email Sending:
- Async via Celery with synchronous fallback
- fail_silently=True to not block password change
- Includes security audit details (IP, timestamp, device)
3. Security Benefits:
- Users notified of all password changes
- Helps detect unauthorized access
- Provides audit trail for security incidents
- Clear action steps if account compromised
This is a notification (not confirmation) - the password is already
changed. Users can detect and respond to unauthorized changes.
Workflow:
- Password Change: Immediate + notification email (logged in)
- Password Reset: Email with token → change (logged out)
* Add direct password reset link to security notification email
Enhanced the password change notification email with a prominent
"Reset Password Now" button/link for compromised accounts.
Improvements:
1. HTML Email:
- Added red "Reset Password Now" button (urgent styling)
- Links directly to password reset page on frontend
- Reduces friction for users to secure their account
- Clearer action hierarchy (reset first, then review)
2. Text Email:
- Added direct reset password URL
- Clear call-to-action for text-only email clients
3. Context:
- Added reset_password_url to email context
- Constructed from FRONTEND_URL setting
- Points to /reset-password page
Security Benefits:
- One-click access to password reset (fastest response)
- Reduces time window for attackers to cause damage
- Follows industry best practices (GitHub, Google, etc.)
- Makes security response as easy as possible
User Experience:
- If compromised: Click button → immediately start reset
- If authorized: Ignore email → account already secured
* Add frontend password reset pages and routes
- Create PasswordResetRequestPage for email submission
- Create PasswordResetConfirmPage for token-based password reset
- Add routes for /reset-password and /reset-password/confirm
- Add API functions requestPasswordReset and confirmPasswordReset
- Add "Forgot password?" link to login form
- Add CSS styling for all password reset pages
This completes the password reset feature end-to-end, fixing the 404 error
when users click the "Reset Password Now" link in security notification emails.
* Fix password reset email link to go to confirm page
The reset link in the email was pointing to /reset-password instead of
/reset-password/confirm?token=..., preventing users from actually
resetting their password. Now the link correctly goes to the confirm
page where users can enter their new password.
* Add direct password reset link to security notification email
When a password is changed, the security notification email now includes
a direct link to the password reset confirmation page with a pre-generated
token. This allows users whose accounts may be compromised to immediately
reset their password with one click, instead of having to:
1. Click link to request page
2. Enter email
3. Wait for another email
4. Click that link
5. Finally reset password
Now it's just: Click link → Reset password immediately.
* Fix flickering when navigating to password reset pages
The theme was being re-applied even when already correctly set, causing
a brief black flash during page transitions. Now the code checks if the
current theme matches the expected theme before updating, preventing
unnecessary DOM manipulation and eliminating the flickering effect.
* Use React Router Link instead of anchor tags in LoginForm
Replaced <a href> tags with <Link to> components to enable client-side
navigation. This prevents full page reloads that cause flickering when
navigating from login to register or password reset pages.
- "Register here" link now uses Link component
- "Forgot password?" link now uses Link component
This ensures smooth transitions consistent with navbar navigation.
* Refactor password reset pages to match login/register structure
Extracted form logic into separate components to maintain consistency
with existing authentication pages:
- Created PasswordResetRequestForm component in components/auth/
- Created PasswordResetConfirmForm component in components/auth/
- Moved CSS files to components/auth/ with renamed files
- Simplified page files to just render form components
This improves code organization, consistency, and maintainability by
following the established pattern where pages handle routing and forms
handle UI/logic.
* Fix: Lint
* Fix: Lint
* Fix: Add missing migration scripts
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7e40ec5 commit 199c042
File tree
22 files changed
+2051
-2
lines changed- backend/apps
- authentication
- migrations
- templates/emails
- points/migrations
- frontend/src
- api
- components/auth
- pages
22 files changed
+2051
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
Lines changed: 95 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
411 | 476 | | |
412 | 477 | | |
413 | 478 | | |
| |||
420 | 485 | | |
421 | 486 | | |
422 | 487 | | |
| 488 | + | |
| 489 | + | |
423 | 490 | | |
424 | 491 | | |
425 | 492 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
0 commit comments