0
0
Fork 0

Add ability to require approval when users sign up using specific email domains (#28468)

This commit is contained in:
Claire 2024-01-04 10:07:05 +01:00 committed by GitHub
parent 195b89d336
commit dfdadb92e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 84 additions and 16 deletions

View file

@ -27,6 +27,27 @@ RSpec.describe AppSignUpService, type: :service do
end
end
context 'when the email address requires approval' do
before do
Setting.registrations_mode = 'open'
Fabricate(:email_domain_block, allow_with_approval: true, domain: 'email.com')
end
it 'creates an unapproved user', :aggregate_failures do
access_token = subject.call(app, remote_ip, params)
expect(access_token).to_not be_nil
expect(access_token.scopes.to_s).to eq 'read write'
user = User.find_by(id: access_token.resource_owner_id)
expect(user).to_not be_nil
expect(user.confirmed?).to be false
expect(user.approved?).to be false
expect(user.account).to_not be_nil
expect(user.invite_request).to be_nil
end
end
context 'when registrations are closed' do
before do
Setting.registrations_mode = 'none'