diff options
author | http://jneen.net/ <jneen@jneen.net> | 2017-02-28 13:19:52 -0800 |
---|---|---|
committer | http://jneen.net/ <jneen@jneen.net> | 2017-03-09 11:49:52 -0800 |
commit | 0ea04cc5bfcc125875a6e0f46702389f0e2e19c0 (patch) | |
tree | d5cb804a8ce4c5a28bd9cc40724fc96457c29e7f /app/controllers/concerns/authenticates_with_two_factor.rb | |
parent | d9cfed07cd1048328499ae06807368be29bdeb2c (diff) | |
download | gitlab-ce-0ea04cc5bfcc125875a6e0f46702389f0e2e19c0.tar.gz |
use the policy stack to protect logins
Diffstat (limited to 'app/controllers/concerns/authenticates_with_two_factor.rb')
-rw-r--r-- | app/controllers/concerns/authenticates_with_two_factor.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/app/controllers/concerns/authenticates_with_two_factor.rb b/app/controllers/concerns/authenticates_with_two_factor.rb index 4c497711fc0..ea441b1736b 100644 --- a/app/controllers/concerns/authenticates_with_two_factor.rb +++ b/app/controllers/concerns/authenticates_with_two_factor.rb @@ -23,7 +23,7 @@ module AuthenticatesWithTwoFactor # # Returns nil def prompt_for_two_factor(user) - return locked_user_redirect(user) if user.access_locked? + return locked_user_redirect(user) unless user.can?(:log_in) session[:otp_user_id] = user.id setup_u2f_authentication(user) @@ -37,10 +37,9 @@ module AuthenticatesWithTwoFactor def authenticate_with_two_factor user = self.resource = find_user + return locked_user_redirect(user) unless user.can?(:log_in) - if user.access_locked? - locked_user_redirect(user) - elsif user_params[:otp_attempt].present? && session[:otp_user_id] + if user_params[:otp_attempt].present? && session[:otp_user_id] authenticate_with_two_factor_via_otp(user) elsif user_params[:device_response].present? && session[:otp_user_id] authenticate_with_two_factor_via_u2f(user) |