mirror of
https://github.com/simple-login/app.git
synced 2025-02-25 08:13:16 +08:00
take into account custom_domain.auto_create_regex in try_auto_create_catch_all_domain()
This commit is contained in:
parent
a6c874e914
commit
344f8e67d2
1 changed files with 14 additions and 2 deletions
|
@ -133,10 +133,22 @@ def try_auto_create_catch_all_domain(address: str) -> Optional[Alias]:
|
|||
return None
|
||||
|
||||
# custom_domain exists
|
||||
if not custom_domain.catch_all:
|
||||
if not custom_domain.catch_all and not custom_domain.auto_create_regex:
|
||||
return None
|
||||
|
||||
# custom_domain has catch-all enabled
|
||||
if custom_domain.auto_create_regex:
|
||||
local = get_email_local_part(address)
|
||||
regex = re.compile(custom_domain.auto_create_regex)
|
||||
if not re.fullmatch(regex, local):
|
||||
LOG.d(
|
||||
"%s can't be auto created on %s as it fails regex %s",
|
||||
address,
|
||||
custom_domain,
|
||||
custom_domain.auto_create_regex,
|
||||
)
|
||||
return None
|
||||
|
||||
# custom_domain has catch-all enabled or the address passes the regex
|
||||
domain_user: User = custom_domain.user
|
||||
|
||||
if not domain_user.can_create_new_alias():
|
||||
|
|
Loading…
Reference in a new issue