mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 17:08:30 +01:00
feat: allow override mailbox verification code (#2239)
This commit is contained in:
parent
80404b4dca
commit
6d17eaa1ec
2 changed files with 7 additions and 1 deletions
|
@ -657,3 +657,7 @@ PARTNER_DOMAINS: dict[int, str] = read_partner_dict("PARTNER_DOMAINS")
|
|||
PARTNER_DOMAIN_VALIDATION_PREFIXES: dict[int, str] = read_partner_dict(
|
||||
"PARTNER_DOMAIN_VALIDATION_PREFIXES"
|
||||
)
|
||||
|
||||
MAILBOX_VERIFICATION_OVERRIDE_CODE: Optional[str] = os.environ.get(
|
||||
"MAILBOX_VERIFICATION_OVERRIDE_CODE", None
|
||||
)
|
||||
|
|
|
@ -212,7 +212,9 @@ def generate_activation_code(
|
|||
mailbox: Mailbox, use_digit_code: bool = False
|
||||
) -> MailboxActivation:
|
||||
clear_activation_codes_for_mailbox(mailbox)
|
||||
if use_digit_code:
|
||||
if config.MAILBOX_VERIFICATION_OVERRIDE_CODE:
|
||||
code = config.MAILBOX_VERIFICATION_OVERRIDE_CODE
|
||||
elif use_digit_code:
|
||||
code = "{:06d}".format(random.randint(1, 999999))
|
||||
else:
|
||||
code = secrets.token_urlsafe(16)
|
||||
|
|
Loading…
Reference in a new issue