Unverified Commit e6f58cb8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Avoid false validation when create user


Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 430c710cd302
......@@ -468,6 +468,6 @@ def temp_oauth_email?
end
def generate_tmp_oauth_email
self.email = "temp-email-for-oauth-#{username}"
self.email = "temp-email-for-oauth-#{username}@gitlab.localhost"
end
end
......@@ -34,14 +34,13 @@ def create(auth)
# In this case we generate temporary email and force user to fill it later
if user.email.blank?
user.generate_tmp_oauth_email
user.save!(validate: false)
else
# Google oauth returns email but dont return nickname
# So we use part of email as username for new user
user.username = email.match(/^[^@]*/)[0]
user.save
end
user.save!
log.info "(OAuth) Creating user #{email} from login with extern_uid => #{uid}"
if Gitlab.config.omniauth['block_auto_created_users'] && !ldap?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment