Unlike in Craft2, there doesn't seem to be a way in Craft3 for a plugin to automatically login a user after a password reset.

In Craft2, a plugin could listen for users.onSetPassword to determine when a user had reset their password, and then log the user in.

However, Craft3 doesn't seem to raise any suitable event -- presumably if it did, it would be done in UsersController->actionSetPassword.

The documentation does state:

The setPasswordSuccessPath config setting designates where the user should be redirected to after they finish resetting their password (and get automatically logged-in).

However, this bit about getting automatically logged in doesn't seem to apply when setPasswordSuccessPath is set.

Is there something that I'm missing here?


Those docs were a bit confusing/misleading, so sorry about that. (I don’t even know what it meant by that!)

They’ve been updated for clarity:

After the user successfully logs in, they will be redirected to the path defined by the setPasswordSuccessPath config setting.

Additionally, the next Craft release (3.1.8) will start automatically logging users in after resetting their password, if the autoLoginAfterAccountActivation config setting is enabled.

So to answer your question, there won’t be any custom plugin/module code needed for this; just update to 3.1.8 when it comes out and enable that config setting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.