mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:44:40 +08:00
FIX: Check if invite domain is valid (#15238)
* FIX: Check if invite domain is valid Previous regex checked for generic hostname, which is too generic for this case.
This commit is contained in:
@ -38,6 +38,14 @@ describe Invite do
|
||||
expect(invite.valid?).to eq(false)
|
||||
expect(invite.errors.full_messages).to include(I18n.t('invite.invalid_email', email: invite.email))
|
||||
end
|
||||
|
||||
it 'allows only valid domains' do
|
||||
invite = Fabricate.build(:invite, domain: 'example', invited_by: user)
|
||||
expect(invite).not_to be_valid
|
||||
|
||||
invite = Fabricate.build(:invite, domain: 'example.com', invited_by: user)
|
||||
expect(invite).to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
context 'before_save' do
|
||||
|
Reference in New Issue
Block a user