Commit b9e573db authored by Douwe Maan's avatar Douwe Maan

Skip validation when creating internal (ghost, service desk) users

parent d39b16d0
...@@ -1068,11 +1068,13 @@ class User < ActiveRecord::Base ...@@ -1068,11 +1068,13 @@ class User < ActiveRecord::Base
User.find_by_email(s) User.find_by_email(s)
end end
scope.create( user = scope.build(
username: username, username: username,
email: email, email: email,
&creation_block &creation_block
) )
user.save(validate: false)
user
ensure ensure
Gitlab::ExclusiveLease.cancel(lease_key, uuid) Gitlab::ExclusiveLease.cancel(lease_key, uuid)
end end
......
---
title: Skip validation when creating internal (ghost, service desk) users
merge_request:
author:
...@@ -1556,6 +1556,16 @@ describe User, models: true do ...@@ -1556,6 +1556,16 @@ describe User, models: true do
expect(ghost.email).to eq('ghost1@example.com') expect(ghost.email).to eq('ghost1@example.com')
end end
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 end
describe '#update_two_factor_requirement' do describe '#update_two_factor_requirement' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment