mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 00:48:32 +01:00
allow user to create alias with domain that has ownership verified (and might not have MX verified)
This commit is contained in:
parent
335a89f912
commit
80b0af91e5
4 changed files with 20 additions and 10 deletions
|
@ -694,7 +694,7 @@ class User(Base, ModelMixin, UserMixin, PasswordOracle):
|
|||
return sub
|
||||
|
||||
def verified_custom_domains(self) -> List["CustomDomain"]:
|
||||
return CustomDomain.filter_by(user_id=self.id, verified=True).all()
|
||||
return CustomDomain.filter_by(user_id=self.id, ownership_verified=True).all()
|
||||
|
||||
def mailboxes(self) -> List["Mailbox"]:
|
||||
"""list of mailbox that user own"""
|
||||
|
|
|
@ -126,7 +126,9 @@ def test_custom_domain_alias(flask_client):
|
|||
user = login(flask_client)
|
||||
|
||||
# create a custom domain
|
||||
CustomDomain.create(user_id=user.id, domain="ab.cd", verified=True, commit=True)
|
||||
CustomDomain.create(
|
||||
user_id=user.id, domain="ab.cd", ownership_verified=True, commit=True
|
||||
)
|
||||
|
||||
signed_suffix = signer.sign("@ab.cd").decode()
|
||||
|
||||
|
@ -210,7 +212,9 @@ def test_cannot_create_alias_in_trash(flask_client):
|
|||
user = login(flask_client)
|
||||
|
||||
# create a custom domain
|
||||
CustomDomain.create(user_id=user.id, domain="ab.cd", verified=True, commit=True)
|
||||
CustomDomain.create(
|
||||
user_id=user.id, domain="ab.cd", ownership_verified=True, commit=True
|
||||
)
|
||||
|
||||
signed_suffix = signer.sign("@ab.cd").decode()
|
||||
|
||||
|
|
|
@ -40,7 +40,9 @@ def test_with_hostname(flask_client):
|
|||
|
||||
def test_with_custom_domain(flask_client):
|
||||
user = login(flask_client)
|
||||
CustomDomain.create(user_id=user.id, domain="ab.cd", verified=True, commit=True)
|
||||
CustomDomain.create(
|
||||
user_id=user.id, domain="ab.cd", ownership_verified=True, commit=True
|
||||
)
|
||||
|
||||
r = flask_client.post(
|
||||
url_for("api.new_random_alias", hostname="www.test.com"),
|
||||
|
|
|
@ -101,7 +101,7 @@ def test_verify_prefix_suffix(flask_client):
|
|||
user = login(flask_client)
|
||||
Session.commit()
|
||||
|
||||
CustomDomain.create(user_id=user.id, domain="test.com", verified=True)
|
||||
CustomDomain.create(user_id=user.id, domain="test.com", ownership_verified=True)
|
||||
|
||||
assert verify_prefix_suffix(user, "prefix", "@test.com")
|
||||
assert not verify_prefix_suffix(user, "prefix", "@abcd.com")
|
||||
|
@ -114,7 +114,7 @@ def test_verify_prefix_suffix(flask_client):
|
|||
def test_available_suffixes(flask_client):
|
||||
user = login(flask_client)
|
||||
|
||||
CustomDomain.create(user_id=user.id, domain="test.com", verified=True)
|
||||
CustomDomain.create(user_id=user.id, domain="test.com", ownership_verified=True)
|
||||
|
||||
assert len(get_available_suffixes(user)) > 0
|
||||
|
||||
|
@ -129,7 +129,9 @@ def test_available_suffixes_default_domain(flask_client):
|
|||
user = login(flask_client)
|
||||
|
||||
sl_domain = SLDomain.first()
|
||||
CustomDomain.create(user_id=user.id, domain="test.com", verified=True, commit=True)
|
||||
CustomDomain.create(
|
||||
user_id=user.id, domain="test.com", ownership_verified=True, commit=True
|
||||
)
|
||||
|
||||
user.default_alias_public_domain_id = sl_domain.id
|
||||
|
||||
|
@ -146,9 +148,11 @@ def test_available_suffixes_default_domain(flask_client):
|
|||
def test_available_suffixes_random_prefix_generation(flask_client):
|
||||
user = login(flask_client)
|
||||
|
||||
CustomDomain.create(user_id=user.id, domain="test.com", verified=True, commit=True)
|
||||
CustomDomain.create(
|
||||
user_id=user.id, domain="test.com", ownership_verified=True, commit=True
|
||||
)
|
||||
cd2 = CustomDomain.create(
|
||||
user_id=user.id, domain="test2.com", verified=True, commit=True
|
||||
user_id=user.id, domain="test2.com", ownership_verified=True, commit=True
|
||||
)
|
||||
|
||||
user.default_alias_custom_domain_id = cd2.id
|
||||
|
@ -255,7 +259,7 @@ def test_add_alias_in_custom_domain_trash(flask_client):
|
|||
user = login(flask_client)
|
||||
|
||||
custom_domain = CustomDomain.create(
|
||||
user_id=user.id, domain="ab.cd", verified=True, commit=True
|
||||
user_id=user.id, domain="ab.cd", ownership_verified=True, commit=True
|
||||
)
|
||||
|
||||
# delete a custom-domain alias: alias should go the DomainDeletedAlias
|
||||
|
|
Loading…
Reference in a new issue