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

Handle deleted account when checking whether MFA is setup #390

Merged

Conversation

janko
Copy link
Contributor

@janko janko commented Jan 11, 2024

It's possible that an account is signed in but the record gets deleted in the database, especially in development where it's common to clear testing data. When #uses_two_factor_authentication? is called, it ends up calling #has_password?, which errors if the logged in account record doesn't exist. I thought it would be nice if Rodauth gracefully handled that.

I also made two spec changes on the way: one was to use the PASSWORD_HASH_TABLE constant, the other was renaming the spec name to communicate that it's testing all MFA behavior.

@jeremyevans
Copy link
Owner

Thanks for the patch! I agree that this makes things nicer.

@jeremyevans jeremyevans merged commit 3d73dac into jeremyevans:master Jan 11, 2024
16 checks passed
@janko janko deleted the handle-no-account-in-has-password branch January 11, 2024 21:01
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.

2 participants