Commit e6f58cb87da914f2a424df66b680e19e49dcd2e6

Authored by Dmitriy Zaporozhets
1 parent 5436d6af

Avoid false validation when create user

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing 2 changed files with 2 additions and 3 deletions   Show diff stats
app/models/user.rb
... ... @@ -468,6 +468,6 @@ class User &lt; ActiveRecord::Base
468 468 end
469 469  
470 470 def generate_tmp_oauth_email
471   - self.email = "temp-email-for-oauth-#{username}"
  471 + self.email = "temp-email-for-oauth-#{username}@gitlab.localhost"
472 472 end
473 473 end
... ...
lib/gitlab/oauth/user.rb
... ... @@ -34,14 +34,13 @@ module Gitlab
34 34 # In this case we generate temporary email and force user to fill it later
35 35 if user.email.blank?
36 36 user.generate_tmp_oauth_email
37   - user.save!(validate: false)
38 37 else
39 38 # Google oauth returns email but dont return nickname
40 39 # So we use part of email as username for new user
41 40 user.username = email.match(/^[^@]*/)[0]
42   - user.save
43 41 end
44 42  
  43 + user.save!
45 44 log.info "(OAuth) Creating user #{email} from login with extern_uid => #{uid}"
46 45  
47 46 if Gitlab.config.omniauth['block_auto_created_users'] && !ldap?
... ...