Avoid false validation when create user

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-04-07 16:47:37 +03:00
parent 5436d6afd6
commit e6f58cb87d
No known key found for this signature in database
GPG Key ID: 627C5F589F467F17
2 changed files with 2 additions and 3 deletions

View File

@ -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

View File

@ -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?