Пример #1
0
def send_email_changed_confirmation_email(user, token, expiry_text):
    """
    Send the user an email confirming their new email. Goes to the new address
    """
    logger.info(
        f"Sending email changed (confirmation) email to {user=} (old email: {user.email=}, new email: {user.new_email=})"
    )
    confirmation_link = urls.change_email_link(confirmation_token=token)
    return email.send_email_template(user.email,
                                     "email_changed_confirmation",
                                     template_args={
                                         "user": user,
                                         "confirmation_link": confirmation_link
                                     })
Пример #2
0
def send_email_changed_confirmation_to_new_email(user):
    """
    Send an email to user's new email address requesting confirmation of email change
    """
    logger.info(
        f"Sending email changed (confirmation) email to {user=}'s new email address, (old email: {user.email}, new email: {user.new_email=})"
    )

    confirmation_link = urls.change_email_link(
        confirmation_token=user.new_email_token)
    email.enqueue_email_from_template(
        user.new_email,
        "email_changed_confirmation_new_email",
        template_args={
            "user": user,
            "confirmation_link": confirmation_link
        },
    )