1
0
forked from ScoDoc/ScoDoc
ScoDoc-Front/app/auth/email.py

16 lines
547 B
Python
Raw Normal View History

2021-05-29 18:22:51 +02:00
# -*- coding: UTF-8 -*
from flask import render_template, current_app
from flask_babel import _
from app.email import get_from_addr, send_email
2021-05-29 18:22:51 +02:00
def send_password_reset_email(user):
token = user.get_reset_password_token()
send_email(
"[ScoDoc] Réinitialisation de votre mot de passe",
sender=get_from_addr(),
2021-05-29 18:22:51 +02:00
recipients=[user.email],
text_body=render_template("email/reset_password.txt", user=user, token=token),
html_body=render_template("email/reset_password.j2", user=user, token=token),
2021-05-29 18:22:51 +02:00
)