Browse Source

Set condition based on class having the 2fa module rather than hardcoding class name

pull/367/head
baarkerlounger 3 years ago
parent
commit
6cca4fe5ef
  1. 3
      app/controllers/auth/passwords_controller.rb

3
app/controllers/auth/passwords_controller.rb

@ -51,7 +51,8 @@ class Auth::PasswordsController < Devise::PasswordsController
protected
def set_2fa_required
return unless resource_class == AdminUser
return unless resource.respond_to?(:need_two_factor_authentication?) &&
resource.need_two_factor_authentication?(request)
warden.session(resource_class.name.underscore)[TwoFactorAuthentication::NEED_AUTHENTICATION] = true
end

Loading…
Cancel
Save