Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2016-06-09 02:09:43 +0300
committerPatricio Cano <suprnova32@gmail.com>2016-06-09 02:09:43 +0300
commit9282810fb7b6102657a0ddb2a02f71b6da22067f (patch)
tree36a334f683c12fe6db63c3b4ef2df2febbf09752 /lib/gitlab/o_auth
parentc593154cb4f0215851fbbae1dde753dacbaa6713 (diff)
Syntax fixes and better logging around the `ldap_person` method.
Diffstat (limited to 'lib/gitlab/o_auth')
-rw-r--r--lib/gitlab/o_auth/user.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/gitlab/o_auth/user.rb b/lib/gitlab/o_auth/user.rb
index 5e52979093d..78f3ecb4cb4 100644
--- a/lib/gitlab/o_auth/user.rb
+++ b/lib/gitlab/o_auth/user.rb
@@ -70,15 +70,16 @@ module Gitlab
# If a corresponding person exists with same uid in a LDAP server,
# check if the user already has a GitLab account.
- if (user = Gitlab::LDAP::User.find_by_uid_and_provider(ldap_person.dn, ldap_person.provider))
+ user = Gitlab::LDAP::User.find_by_uid_and_provider(ldap_person.dn, ldap_person.provider)
+ if user
# Case when a LDAP user already exists in Gitlab. Add the OAuth identity to existing account.
- log.info "LDAP account found for user #{user.username}. Building new identity."
+ log.info "LDAP account found for user #{user.username}. Building new #{auth_hash.provider} identity."
user.identities.build(extern_uid: auth_hash.uid, provider: auth_hash.provider)
else
- log.info 'No existing LDAP account was found in GitLab. Checking for OAuth account.'
+ log.info "No existing LDAP account was found in GitLab. Checking for #{auth_hash.provider} account."
user = find_by_uid_and_provider
if user.nil?
- log.info 'No user found with the specified OAuth provider. Creating a new one.'
+ log.info "No user found using #{auth_hash.provider} provider. Creating a new one."
user = build_new_user
end
log.info "Correct account has been found. Adding LDAP identity to user: #{user.username}."