Skip validation when creating internal (ghost, service desk) users
This commit is contained in:
parent
d39b16d06d
commit
b9e573db57
3 changed files with 17 additions and 1 deletions
|
@ -1068,11 +1068,13 @@ class User < ActiveRecord::Base
|
|||
User.find_by_email(s)
|
||||
end
|
||||
|
||||
scope.create(
|
||||
user = scope.build(
|
||||
username: username,
|
||||
email: email,
|
||||
&creation_block
|
||||
)
|
||||
user.save(validate: false)
|
||||
user
|
||||
ensure
|
||||
Gitlab::ExclusiveLease.cancel(lease_key, uuid)
|
||||
end
|
||||
|
|
4
changelogs/unreleased/dm-fix-ghost-user-validation.yml
Normal file
4
changelogs/unreleased/dm-fix-ghost-user-validation.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Skip validation when creating internal (ghost, service desk) users
|
||||
merge_request:
|
||||
author:
|
|
@ -1556,6 +1556,16 @@ describe User, models: true do
|
|||
expect(ghost.email).to eq('ghost1@example.com')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a domain whitelist is in place' do
|
||||
before do
|
||||
stub_application_setting(domain_whitelist: ['gitlab.com'])
|
||||
end
|
||||
|
||||
it 'creates a ghost user' do
|
||||
expect(User.ghost).to be_persisted
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#update_two_factor_requirement' do
|
||||
|
|
Loading…
Reference in a new issue