mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: add setting auto_approve_email_domains to auto approve users (#9323)
* FEATURE: add setting `auto_approve_email_domains` to auto approve users This commit adds a new site setting `auto_approve_email_domains` to auto approve users based on their email address domain. Note that if a domain already exists in `email_domains_whitelist` then `auto_approve_email_domains` needs to be duplicated there as well, since users won’t be able to register with email address that is not allowed in `email_domains_whitelist`. * Update config/locales/server.en.yml Co-Authored-By: Robin Ward <robin.ward@gmail.com>
This commit is contained in:
@@ -59,7 +59,7 @@ describe InviteRedeemer do
|
||||
end
|
||||
|
||||
describe "#redeem" do
|
||||
fab!(:invite) { Fabricate(:invite) }
|
||||
fab!(:invite) { Fabricate(:invite, email: "foobar@example.com") }
|
||||
let(:name) { 'john snow' }
|
||||
let(:username) { 'kingofthenorth' }
|
||||
let(:password) { 'know5nOthiNG' }
|
||||
@@ -102,6 +102,16 @@ describe InviteRedeemer do
|
||||
expect(user.approved).to eq(true)
|
||||
end
|
||||
|
||||
it "should redeem the invite if invited by non staff and approve if email in auto_approve_email_domains setting" do
|
||||
SiteSetting.must_approve_users = true
|
||||
SiteSetting.auto_approve_email_domains = "example.com"
|
||||
user = invite_redeemer.redeem
|
||||
|
||||
expect(user.name).to eq(name)
|
||||
expect(user.username).to eq(username)
|
||||
expect(user.approved).to eq(true)
|
||||
end
|
||||
|
||||
it "should not blow up if invited_by user has been removed" do
|
||||
invite.invited_by.destroy!
|
||||
invite.reload
|
||||
|
||||
Reference in New Issue
Block a user