diff options
author | Markus Koller <markus-koller@gmx.ch> | 2017-01-25 00:09:58 +0300 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-04-06 11:01:13 +0300 |
commit | a3430f011f1adceaef8484f38a57018712a18ad2 (patch) | |
tree | ae69438c98358e214c39517ad4ceddf60d15c65a /app/controllers/application_controller.rb | |
parent | 57374feabe1428b2ea06a6a3cac244612128095d (diff) |
Support 2FA requirement per-group
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b197fd2157e..28c4380ca84 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -267,11 +267,19 @@ class ApplicationController < ActionController::Base end def two_factor_authentication_required? - current_application_settings.require_two_factor_authentication + current_application_settings.require_two_factor_authentication || + current_user.try(:require_two_factor_authentication) end def two_factor_grace_period - current_application_settings.two_factor_grace_period + if current_user.try(:require_two_factor_authentication) + [ + current_application_settings.two_factor_grace_period, + current_user.two_factor_grace_period + ].min + else + current_application_settings.two_factor_grace_period + end end def two_factor_grace_period_expired? |