Skip to content

Commit

Permalink
feat: allow override mailbox verification code (#2239)
Browse files Browse the repository at this point in the history
  • Loading branch information
cquintana92 authored Sep 30, 2024
1 parent 80404b4 commit 6d17eaa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,3 +657,7 @@ def read_partner_dict(var: str) -> dict[int, str]:
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
)
4 changes: 3 additions & 1 deletion app/mailbox_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6d17eaa

Please sign in to comment.