Handle deleted account when checking whether MFA is setup #390
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.