Skip to content

Conversation

@MrLijan
Copy link

@MrLijan MrLijan commented Nov 21, 2025

What?

Added execution of beforeLogin and afterLogin hooks during the password reset operation in resetPasswordOperation(). These hooks now execute with the same parameters and flow as they do in the standard login operation, ensuring consistent behavior across both authentication paths.

  • packages/payload/src/auth/operations/resetPassword.ts - Added hook execution before and after JWT token generation.

Why?

When a user resets their password, the operation performs two phases: updating the password in the database, then automatically logging the user in with a new session and JWT token. However, beforeLogin and afterLogin hooks were not being triggered during this auto-login phase, creating inconsistent behavior compared to standard login.
This caused issues for applications that uses afterLogin hooks to attach additional cookie (for example).

How?

Triggered beforeLogin and afterLogin in resetPassword.ts

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