summaryrefslogtreecommitdiff
path: root/lib/gitlab/ldap/user.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ldap/user.rb')
-rw-r--r--lib/gitlab/ldap/user.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/ldap/user.rb b/lib/gitlab/ldap/user.rb
index 3ef494ba137..cfa8692659d 100644
--- a/lib/gitlab/ldap/user.rb
+++ b/lib/gitlab/ldap/user.rb
@@ -40,12 +40,16 @@ module Gitlab
def update_user_attributes
gl_user.email = auth_hash.email
- gl_user.identities.build(provider: auth_hash.provider, extern_uid: auth_hash.uid)
+
+ # Build new identity only if we dont have have same one
+ gl_user.identities.find_or_initialize_by(provider: auth_hash.provider,
+ extern_uid: auth_hash.uid)
+
gl_user
end
def changed?
- gl_user.changed?
+ gl_user.changed? || gl_user.identities.any?(&:changed?)
end
def needs_blocking?