Browse Source

Warden hook: refactor to not perform inline assignment for clarity

master
Laust Rud Jacobsen 11 years ago
parent
commit
20703c0397
  1. 4
      lib/two_factor_authentication/hooks/two_factor_authenticatable.rb

4
lib/two_factor_authentication/hooks/two_factor_authenticatable.rb

@ -1,6 +1,8 @@
Warden::Manager.after_authentication do |user, auth, options|
if user.respond_to?(:need_two_factor_authentication?)
if auth.session(options[:scope])[TwoFactorAuthentication::NEED_AUTHENTICATION] = user.need_two_factor_authentication?(auth.request)
need_code = user.need_two_factor_authentication?(auth.request)
auth.session(options[:scope])[TwoFactorAuthentication::NEED_AUTHENTICATION] = need_code
if need_code
user.send_two_factor_authentication_code
end
end

Loading…
Cancel
Save