Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The act of resetting a password should automatically mark a user as "verified" #4066

Closed
burggraf opened this issue Jan 2, 2024 · 7 comments

Comments

@burggraf
Copy link

burggraf commented Jan 2, 2024

Scenario: The user signs up and never receives a confirmation email. The user clicks on "forgot password" and gets a password reset link, click it, and changes their password. At this point they are still "unverified", though I would argue that ARE verified since they received an email at the given address and clicked on it to verify the address is valid.

This would be the solution to "I didn't get a verification email" -- answer: "just reset your password."

@ganigeorgiev
Copy link
Member

It makes sense, I'll consider it for the next release.

@burggraf
Copy link
Author

burggraf commented Jan 2, 2024

I figured I could hack it with:
onRecordAfterConfirmPasswordResetRequest
but that doesn't seem to be firing when I click to reset my password, or maybe I'm misunderstanding that hook?

@ganigeorgiev
Copy link
Member

ganigeorgiev commented Jan 2, 2024

The onRecordAfterConfirmPasswordResetRequest will be fired after the user clicks on the email link and successfully resets their password.

To avoid resaving the record, you can use its before hook, something like:

onRecordBeforeConfirmPasswordResetRequest((e) => {
    if (e.record) {
        e.record.setVerified(true); // this will be saved only if the password reset is successful
    }
})

@burggraf
Copy link
Author

burggraf commented Jan 2, 2024

I just never see that trigger firing for some reason.

@burggraf
Copy link
Author

burggraf commented Jan 2, 2024

Never mind, my mistake. Environment isn't set up right.

@burggraf
Copy link
Author

burggraf commented Jan 2, 2024

Yep, that works. Hooks rock.

@ganigeorgiev
Copy link
Member

This is implemented in the develop branch and will be available with the next v0.21.0 release (there are no ETAs yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants