ENH Refactor password reset to support SameSite=Strict #11566
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Performing an immediate redirect on a request from an external website, such as a web-based email client, causes the new request to be treated as external, and when the session cookie is set to Samesite=Strict, this prevents the cookie from being sent by the browser, triggering a fresh session. This meant that the existing password reset mechanism would not function in this mode, as the AutoLoginHash was being stored in the session and immediately lost, triggering a redirect to the login form.
This change refactors the change password handler to instead push the AutoLoginHash value into the change password form as a hidden field, ensuring it can be read during submission.
It also includes broader test coverage of the change password handler, though this remains incomplete due to time constraints.
Manual testing steps
Enable SameSite=Strict on session cookies:
Issues
Pull request checklist