summaryrefslogtreecommitdiff
path: root/lib/gitlab
diff options
context:
space:
mode:
authorRobin Bobbitt <ryehle@us.ibm.com>2017-06-07 15:49:45 -0400
committerRobin Bobbitt <ryehle@us.ibm.com>2017-06-07 21:12:51 -0400
commitcb5a5eb89265f7261ecc97b6de5bd26ca092960c (patch)
tree311b3d74e10c8da8cf9c89b5c6684071d932750f /lib/gitlab
parent359a8f1fc8df543e648b734acd332374bd779347 (diff)
downloadgitlab-ce-cb5a5eb89265f7261ecc97b6de5bd26ca092960c.tar.gz
Instruct user to use a personal access token for Git over HTTP
If internal auth is disabled and LDAP is not configured on the instance, present the user with a message to create a personal access token if his Git over HTTP auth attempt fails.
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/auth.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb
index da07ba2f2a3..3933c3b04dd 100644
--- a/lib/gitlab/auth.rb
+++ b/lib/gitlab/auth.rb
@@ -37,7 +37,11 @@ module Gitlab
rate_limit!(ip, success: result.success?, login: login)
Gitlab::Auth::UniqueIpsLimiter.limit_user!(result.actor)
- result
+ return result if result.success? || current_application_settings.signin_enabled? || Gitlab::LDAP::Config.enabled?
+
+ # If sign-in is disabled and LDAP is not configured, recommend a
+ # personal access token on failed auth attempts
+ raise Gitlab::Auth::MissingPersonalTokenError
end
def find_with_user_password(login, password)