Commit 2e8b0fa5cf9e70c55bd1dbb254db3f9aa45b23e9

Authored by Dmitriy Zaporozhets
1 parent 6fff92e9

Oauth users and users created by admin should be confirmed immediatly

app/controllers/admin/users_controller.rb
... ... @@ -47,6 +47,7 @@ class Admin::UsersController < Admin::ApplicationController
47 47 @user = User.build_user(params[:user].merge(opts), as: :admin)
48 48 @user.admin = (admin && admin.to_i > 0)
49 49 @user.created_by_id = current_user.id
  50 + @user.confirm!
50 51  
51 52 respond_to do |format|
52 53 if @user.save
... ...
lib/gitlab/oauth/user.rb
... ... @@ -29,6 +29,7 @@ module Gitlab
29 29  
30 30 user = model.build_user(opts, as: :admin)
31 31 user.save!
  32 + user.confirm!
32 33 log.info "(OAuth) Creating user #{email} from login with extern_uid => #{uid}"
33 34  
34 35 if Gitlab.config.omniauth['block_auto_created_users'] && !ldap?
... ...
spec/factories.rb
... ... @@ -23,6 +23,10 @@ FactoryGirl.define do
23 23 end
24 24  
25 25 factory :admin, traits: [:admin]
  26 +
  27 + after :create do |u|
  28 + u.confirm!
  29 + end
26 30 end
27 31  
28 32 factory :project do
... ...