aboutsummaryrefslogtreecommitdiff
path: root/app/auth/email.py
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2019-03-26 16:17:11 +0000
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2019-03-26 16:17:11 +0000
commit98f0fcdcbdbbd91a2a4da6b44229a178ddb38d31 (patch)
treeec6f1254bab7e65954694704a20c947fa268649e /app/auth/email.py
parentAdd email confirmation field (diff)
downloadAnnotateChange-98f0fcdcbdbbd91a2a4da6b44229a178ddb38d31.tar.gz
AnnotateChange-98f0fcdcbdbbd91a2a4da6b44229a178ddb38d31.zip
Add support for email confirmation
Diffstat (limited to 'app/auth/email.py')
-rw-r--r--app/auth/email.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/auth/email.py b/app/auth/email.py
index c071518..581c9ce 100644
--- a/app/auth/email.py
+++ b/app/auth/email.py
@@ -4,6 +4,7 @@ from flask import current_app, render_template
from app.email import send_email
+
def send_password_reset_email(user):
token = user.get_reset_password_token()
send_email(
@@ -17,3 +18,18 @@ def send_password_reset_email(user):
"email/reset_password.html", user=user, token=token
),
)
+
+
+def send_email_confirmation_email(user):
+ token = user.get_email_confirmation_token()
+ send_email(
+ "[AnnotateChange] Confirm your email",
+ sender=current_app.config["ADMINS"][0],
+ recipients=[user.email],
+ text_body=render_template(
+ "email/confirm_email.txt", user=user, token=token
+ ),
+ html_body=render_template(
+ "email/confirm_email.html", user=user, token=token
+ ),
+ )