Skip to content

[6.x] Stop auto-logging in users after password reset#14454

Merged
jasonvarga merged 2 commits into6.xfrom
no-login-after-pw-reset
Apr 7, 2026
Merged

[6.x] Stop auto-logging in users after password reset#14454
jasonvarga merged 2 commits into6.xfrom
no-login-after-pw-reset

Conversation

@jasonvarga
Copy link
Copy Markdown
Member

@jasonvarga jasonvarga commented Apr 7, 2026

Summary

  • Remove the $this->guard()->login($user) call from ResetsPasswords::resetPassword() so users are no longer automatically logged in after resetting their password.
  • Override redirectPath() in the CP ResetPasswordController to redirect to the CP login page.
  • Add status flash handling to HandleInertiaRequests so the "password has been reset" message displays as a toast on the CP login page.
  • Remove the window.location.href reload in Reset.vue's onSuccess callback that was causing a double page load (wiping the flash message). This was necessary before because the user would get logged in and we needed a full reload when entering the control panel.
  • Front-end resets redirect to the redirectPath() (from the form's redirect parameter, or site root) unauthenticated.

This avoids needing special handling for 2FA and passkey-enforced login — the user just logs in normally after resetting their password, and auth checks (2FA, passkeys) happen naturally through the login flow.

Replaces #14449

Test plan

  • Added tests/Auth/ResetPasswordTest.php covering:
    • Password is changed and user is NOT authenticated afterward (CP and web)
    • CP resets redirect to the CP login page
    • Front-end resets redirect to redirect URL or site root
    • 2FA-enabled users get the same behavior
    • Passkey users with allow_password_login_with_passkey=false get the same behavior
  • Manually test CP password reset flow — should see toast on login page
  • Manually test front-end password reset flow — should redirect unauthenticated

🤖 Generated with Claude Code

Instead of logging users in after a password reset, redirect them to
the login page (CP) or the redirect path (front-end) unauthenticated.
This avoids needing special handling for 2FA and passkey-enforced login.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rd reset

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jasonvarga jasonvarga marked this pull request as ready for review April 7, 2026 19:12
@jasonvarga jasonvarga merged commit 12d13f7 into 6.x Apr 7, 2026
19 checks passed
@jasonvarga jasonvarga deleted the no-login-after-pw-reset branch April 7, 2026 19: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.

1 participant