take into account DISABLE_ALIAS_SUFFIX in /api/alias/options
This commit is contained in:
parent
0c2b2ce60e
commit
926cc2935c
|
@ -3,7 +3,7 @@ from flask_cors import cross_origin
|
|||
from sqlalchemy import desc
|
||||
|
||||
from app.api.base import api_bp, verify_api_key
|
||||
from app.config import ALIAS_DOMAINS
|
||||
from app.config import ALIAS_DOMAINS, DISABLE_ALIAS_SUFFIX
|
||||
from app.extensions import db
|
||||
from app.log import LOG
|
||||
from app.models import AliasUsedOn, GenEmail, User
|
||||
|
@ -71,6 +71,9 @@ def options():
|
|||
# maybe better to make sure the suffix is never used before
|
||||
# but this is ok as there's a check when creating a new custom alias
|
||||
for domain in ALIAS_DOMAINS:
|
||||
if DISABLE_ALIAS_SUFFIX:
|
||||
ret["custom"]["suffixes"].append(f"@{domain}")
|
||||
else:
|
||||
ret["custom"]["suffixes"].append(f".{random_word()}@{domain}")
|
||||
|
||||
for custom_domain in user.verified_custom_domains():
|
||||
|
@ -146,8 +149,10 @@ def options_v2():
|
|||
|
||||
# maybe better to make sure the suffix is never used before
|
||||
# but this is ok as there's a check when creating a new custom alias
|
||||
# todo: take into account DISABLE_ALIAS_SUFFIX
|
||||
for domain in ALIAS_DOMAINS:
|
||||
if DISABLE_ALIAS_SUFFIX:
|
||||
ret["suffixes"].append(f"@{domain}")
|
||||
else:
|
||||
ret["suffixes"].append(f".{random_word()}@{domain}")
|
||||
|
||||
for custom_domain in user.verified_custom_domains():
|
||||
|
|
Loading…
Reference in a new issue