Skip to content

Two Factor authentication issue: "undefined method `[]' for nil:NilClass" #264

Answered by janko
jgthms asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks. As I suspected, the issue is in the fact that #uses_two_factor_authentication? method doesn't handle account record getting deleted while Rails session still has it logged in, which happened when you ran rake db:reset.

The quickest solution would be to also check for the presence of the account:

if rodauth(:admin).account! && rodauth(:admin).uses_two_factor_authentication?
  # ...
end

I will see if I can get a patch merged into Rodauth to make #uses_two_factor_authentication? handle this gracefully.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@jgthms
Comment options

@janko
Comment options

Answer selected by jgthms
@jgthms
Comment options

@janko
Comment options

@jgthms
Comment options

@janko
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants