Skip to content

Use Django's built-in password reset confirm flow - #6175

Merged
bjester merged 1 commit into
learningequality:hotfixesfrom
rtibbles:reset_confirm_fix
Sep 24, 2026
Merged

bjester merged 1 commit into
learningequality:hotfixesfrom
rtibbles:reset_confirm_fix

Conversation

@rtibbles

@rtibbles rtibbles commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Reduce our custom code logic in a critical path and revert to Django internals as much as possible
  • Simplifies our code and makes it more robust

References

Reviewer guidance

  1. Run pnpm devserver, then request a reset for user@a.com at /accounts/#/forgot-password — the reset link prints in the server log.
  2. Open the link's path on http://localhost:8080 — it lands on /accounts/#/reset-password?uidb64=… with no token in the URL.
  3. Set a new password — "Password reset successfully".
  4. Sign in with the new password — My channels loads.
  5. Sign out and open the same link again — "Reset link expired".
Screenshot
New password form
password-reset-flow.webm

Server log for the recorded flow (steps 2, 3 and 5):

"GET /en/accounts/password/reset/confirm/Mg/dffe6l-c30a9dde5998b9c64507d56521befcd7/ HTTP/1.1" 302 0
"GET /en/accounts/password/reset/confirm/Mg/set-password/ HTTP/1.1" 302 0
"POST /en/accounts/password/reset/confirm/Mg/set-password/ HTTP/1.1" 302 0
"GET /en/accounts/password/reset/confirm/Mg/dffe6l-c30a9dde5998b9c64507d56521befcd7/ HTTP/1.1" 302 0

Server log for POSTs without a valid reset session:

"POST /en/accounts/password/reset/confirm/Mg/made-up-token/ HTTP/1.1" 403 0
"POST /en/accounts/password/reset/confirm/Mg/set-password/ HTTP/1.1" 403 0

AI usage

Used Claude Code to rework the reset confirm view onto Django's built-in flow and write the tests. Verified with the Django and Jest test suites, the pre-commit linters, and manual QA in a browser against a local devserver.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EZoTHtTrhSDCJsx4PA2AXu

@rtibbles
rtibbles marked this pull request as ready for review September 24, 2026 22:17
@rtibbles
rtibbles requested review from a team and marcellamaki September 24, 2026 22:17

@bjester bjester left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Let PasswordResetConfirmView.dispatch gate the form so the token is
validated from the session, and post the new password to the
set-password URL instead of the emailed token.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EZoTHtTrhSDCJsx4PA2AXu
@bjester
bjester merged commit fc30d83 into learningequality:hotfixes Sep 24, 2026
13 checks passed
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.

2 participants