Commit 1b0198f1d3fc621b339af0e7fd79a74919856d46

Authored by Florian Unglaub
1 parent 6d6c7a17

save newly created users directly in the model

app/controllers/omniauth_callbacks_controller.rb
@@ -39,7 +39,6 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController @@ -39,7 +39,6 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
39 redirect_to profile_path 39 redirect_to profile_path
40 else 40 else
41 @user = User.find_or_new_for_omniauth(oauth) 41 @user = User.find_or_new_for_omniauth(oauth)
42 - @user.save! if @user.try('new_record?')  
43 42
44 if @user 43 if @user
45 sign_in_and_redirect @user 44 sign_in_and_redirect @user
app/models/user.rb
@@ -114,6 +114,8 @@ class User < ActiveRecord::Base @@ -114,6 +114,8 @@ class User < ActiveRecord::Base
114 ) 114 )
115 115
116 @user.blocked = true if Gitlab.config.omniauth.block_auto_created_users 116 @user.blocked = true if Gitlab.config.omniauth.block_auto_created_users
  117 + @user.save!
  118 +
117 @user 119 @user
118 end 120 end
119 end 121 end