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:
authorDouwe Maan <douwe@gitlab.com>2016-01-19 18:25:38 +0300
committerDouwe Maan <douwe@gitlab.com>2016-01-19 18:25:38 +0300
commit98e1a5b63424b6912de98ee5055d3f9e57e63899 (patch)
tree773952fd630e222ec72d368f53e4a238d3d6c839 /lib/gitlab/o_auth/auth_hash.rb
parent425f8d6f572a3ae47c971a48bfefc9907c7bda55 (diff)
Allow LDAP users to change their email if it was not set by the LDAP server
Diffstat (limited to 'lib/gitlab/o_auth/auth_hash.rb')
-rw-r--r--lib/gitlab/o_auth/auth_hash.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/o_auth/auth_hash.rb b/lib/gitlab/o_auth/auth_hash.rb
index ba31599432b..36e5c2670bb 100644
--- a/lib/gitlab/o_auth/auth_hash.rb
+++ b/lib/gitlab/o_auth/auth_hash.rb
@@ -32,6 +32,10 @@ module Gitlab
@password ||= Gitlab::Utils.force_utf8(Devise.friendly_token[0, 8].downcase)
end
+ def has_email?
+ get_info(:email).present?
+ end
+
private
def info
@@ -46,8 +50,8 @@ module Gitlab
def username_and_email
@username_and_email ||= begin
- username = get_info(:username) || get_info(:nickname)
- email = get_info(:email)
+ username = get_info(:username).presence || get_info(:nickname).presence
+ email = get_info(:email).presence
username ||= generate_username(email) if email
email ||= generate_temporarily_email(username) if username