Avoid false validation when create user

Signed-off-by: NDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
上级 5436d6af
......@@ -468,6 +468,6 @@ class User < ActiveRecord::Base
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 @@ module Gitlab
# 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册