summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/helpers.rb4
-rw-r--r--lib/api/session.rb2
2 files changed, 1 insertions, 5 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 3e906f6f929..d0469d6602d 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -275,10 +275,6 @@ module API
end
end
- def render_2fa_error!
- render_api_error!('401 Unauthorized. You have 2FA enabled. Please use a personal access token to access the API', 401)
- end
-
def render_api_error!(message, status)
error!({ 'message' => message }, status)
end
diff --git a/lib/api/session.rb b/lib/api/session.rb
index b26be3be22e..55ec66a6d67 100644
--- a/lib/api/session.rb
+++ b/lib/api/session.rb
@@ -14,7 +14,7 @@ module API
user = Gitlab::Auth.find_with_user_password(params[:email] || params[:login], params[:password])
return unauthorized! unless user
- return render_2fa_error! if user.two_factor_enabled?
+ return render_api_error!('401 Unauthorized. You have 2FA enabled. Please use a personal access token to access the API', 401) if user.two_factor_enabled?
present user, with: Entities::UserLogin
end
end