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

How to turn off two-factor for non password logins i.e. token? #173

Open
sandipransing opened this issue Jun 17, 2019 · 0 comments
Open

Comments

@sandipransing
Copy link

In the docs, there's a method:

   def need_two_factor_authentication?(request)
      request.ip != '127.0.0.1'
   end

However, currently, the only user request is passed to the method and there is no way to access auth winning strategy to make a decision?

   def need_two_factor_authentication?(auth)
      if auth.winning_strategy.instance_of? Devise::Strategies::DatabaseAuthenticatable
         return true
      end
      false # skip 2-factor authentication for token based logins
   end

I think need_two_factor_authentication? method should accept auth as a parameter.

Thanks for your time!

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

No branches or pull requests

1 participant