Exemplo n.º 1
0
def send_password_reset(user: '******', token: str) -> None:
    subject = '[Alerta] Reset password request'
    text = 'You forgot your password. Reset it by clicking on the link below:\n\n' \
           '{url}\n\n' \
           'You\'re receiving this email because you asked for a password reset of an Alerta account.' \
           ' If this wasn\'t you, please ignore this email.'.format(
               url=link(request.referrer, 'reset', token)
           )
    mailer.send_email(user.email, subject, body=text)
Exemplo n.º 2
0
def send_password_reset(user: '******', token: str) -> None:
    subject = '[Alerta] Reset password request'
    text = 'You forgot your password. Reset it by clicking on the link below:\n\n' \
           '{url}\n\n' \
           'You\'re receiving this email because you asked for a password reset of an Alerta account.' \
           ' If this wasn\'t you, please ignore this email.'.format(
               name=user.name, email=user.email, url=link(request.referrer, 'reset', token)
           )
    mailer.send_email(user.email, subject, body=text)
Exemplo n.º 3
0
def send_confirmation(user: '******', token: str) -> None:
    subject = f"[Alerta] Please verify your email '{user.email}'"
    text = 'Hello {name}!\n\n' \
           'Please verify your email address is {email} by clicking on the link below:\n\n' \
           '{url}\n\n' \
           'You\'re receiving this email because you recently created a new Alerta account.' \
           ' If this wasn\'t you, please ignore this email.'.format(
               name=user.name, email=user.email, url=link(request.referrer, 'confirm', token)
           )
    mailer.send_email(user.email, subject, body=text)
Exemplo n.º 4
0
def send_confirmation(user: '******', token: str) -> None:
    subject = "[Alerta] Please verify your email '%s'" % user.email
    text = 'Hello {name}!\n\n' \
           'Please verify your email address is {email} by clicking on the link below:\n\n' \
           '{url}\n\n' \
           'You\'re receiving this email because you recently created a new Alerta account.' \
           ' If this wasn\'t you, please ignore this email.'.format(
               name=user.name, email=user.email, url=link(request.referrer, 'confirm', token)
           )
    mailer.send_email(user.email, subject, body=text)
Exemplo n.º 5
0
def send_password_reset(user):
    token = generate_email_token(email=user.email, salt='reset')
    user.set_email_hash(token)

    subject = '[Alerta] Reset password request'
    text = 'You forgot your password. Reset it by clicking on the link below:\n\n' \
           '{url}\n\n' \
           'You\'re receiving this email because you asked for a password reset of an Alerta account.' \
           ' If this wasn\'t you, please ignore this email.'.format(
               name=user.name, email=user.email, url=urljoin(request.referrer, '/#/reset/' + token)
           )
    mailer.send_email(user.email, subject, body=text)
Exemplo n.º 6
0
def send_confirmation(user):
    token = generate_email_token(email=user.email, salt='confirm')
    user.set_email_hash(token)

    ui_base_url = request.referrer
    print(ui_base_url)

    subject = "[Alerta] Please verify your email '%s'" % user.email
    text = 'Hello {name}!\n\n' \
           'Please verify your email address is {email} by clicking on the link below:\n\n' \
           '{url}\n\n' \
           'You\'re receiving this email because you recently created a new Alerta account.' \
           ' If this wasn\'t you, please ignore this email.'.format(
               name=user.name, email=user.email, url=urljoin(request.referrer, '/#/confirm/' + token)
           )
    mailer.send_email(user.email, subject, body=text)