FIX: email_domains_whitelist prevented creation of anonymous users
This commit is contained in:
parent
76e2b6c825
commit
07649cd42d
|
@ -36,6 +36,7 @@ class AnonymousShadowCreator
|
|||
shadow = User.create!(
|
||||
password: SecureRandom.hex,
|
||||
email: "#{SecureRandom.hex}@anon.#{Discourse.current_hostname}",
|
||||
skip_email_validation: true,
|
||||
name: username, # prevents error when names are required
|
||||
username: username,
|
||||
active: true,
|
||||
|
|
|
@ -10,7 +10,7 @@ describe AnonymousShadowCreator do
|
|||
|
||||
before { SiteSetting.allow_anonymous_posting = true }
|
||||
|
||||
let(:user) { Fabricate(:user, trust_level: 3) }
|
||||
let(:user) { Fabricate(:user_single_email, trust_level: 3) }
|
||||
|
||||
it "returns no shadow if trust level is not met" do
|
||||
expect(AnonymousShadowCreator.get(Fabricate.build(:user, trust_level: 0))).to eq(nil)
|
||||
|
@ -67,6 +67,11 @@ describe AnonymousShadowCreator do
|
|||
expect { AnonymousShadowCreator.get(user) }.to_not raise_error
|
||||
end
|
||||
|
||||
it "works when there is an email whitelist" do
|
||||
SiteSetting.email_domains_whitelist = "wayne.com"
|
||||
|
||||
expect { AnonymousShadowCreator.get(user) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue