emails: hardcode nondisposable email list.

Hardcode the list of nondisposable email providers instead of making it
a config option. Also add a few new providers.

This was previously a config option to keep it secret, but there's not
much need for secrecy here.

A Restricted user's email must be on this list to unrestrict their
account. If a user is Restricted and their email is not in this list,
then it's assumed to be disposable and can't be used to unrestrict their
account even if they verify their email address.
This commit is contained in:
evazion
2021-09-05 18:21:35 -05:00
parent 19f01d4554
commit 28edd5a22a
4 changed files with 74 additions and 21 deletions

View File

@@ -166,7 +166,6 @@ class EmailsControllerTest < ActionDispatch::IntegrationTest
context "for a Restricted user" do
context "with a nondisposable email address" do
should "unrestrict the user's account" do
Danbooru.config.stubs(:email_domain_verification_list).returns(["gmail.com"])
@restricted_user.email_address.update!(address: "test@gmail.com")
get email_verification_url(@restricted_user)
@@ -180,7 +179,6 @@ class EmailsControllerTest < ActionDispatch::IntegrationTest
context "with a disposable email address" do
should "leave the user's account restricted" do
Danbooru.config.stubs(:email_domain_verification_list).returns(["gmail.com"])
@restricted_user.email_address.update!(address: "test@mailinator.com")
get email_verification_url(@restricted_user)
@@ -196,8 +194,6 @@ class EmailsControllerTest < ActionDispatch::IntegrationTest
context "for a Gold user" do
should "not change the user's level" do
@user = create(:gold_user, email_address: build(:email_address, { address: "test@gmail.com", is_verified: false }))
Danbooru.config.stubs(:email_domain_verification_list).returns(["gmail.com"])
get email_verification_url(@user)
assert_redirected_to @user