Exemplo n.º 1
0
def send_reset_passwd_notice(user_obj, email_subj=None, email_html=None, relative_url=None):
    if email_subj is None:
        email_subj = "Password Reset"
    if email_html is None:
        email_html = read_template("email/reset_passwd.html")
    if relative_url is None:
        relative_url = "/user/reset-password/"

    token = generate_token(user_obj, AccountActivity.RESET_PASSWORD)
    url = "%s%s%s/%s/" % (PLOP_DOMAIN, relative_url, user_obj.id(), token)
    email_html = email_html % {"url": url}
    mail = Mail(MAIL_OUTBOUND_REALNAME, MAIL_OUTBOUND_REPLYTO)
    mail.send(user_obj.email, email_subj, email_html, async=True)
Exemplo n.º 2
0
def send_confirmation(user_obj, email_subject=None, email_html=None, relative_url=None):
    if email_subject is None:
        email_subject = "Complete your account registration"
    if email_html is None:
        email_html = read_template("email/verify_email.html")
    if relative_url is None:
        relative_url = "/register/confirm/"

    token = generate_token(user_obj, AccountActivity.VERIFY_EMAIL_ADDR)
    url = "%s%s%s/%s/" % (PLOP_DOMAIN, relative_url, user_obj.id(), token)
    email_html = email_html % {"url": url}
    mail = Mail(MAIL_OUTBOUND_REALNAME, MAIL_OUTBOUND_REPLYTO)
    mail.send(user_obj.email, email_subject, email_html, async=True)