aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/auth
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-08-20 17:05:27 -0500
committerFrederick Muriuki Muriithi2024-08-20 17:05:27 -0500
commite4286d9f04619030054b5a6425b059b783c6d87c (patch)
tree42abc1de89727b60e61ab93b17007659d150192f /gn_auth/auth
parent212ba692337f8e4ba052291a3bda240db9744ff2 (diff)
downloadgn-auth-e4286d9f04619030054b5a6425b059b783c6d87c.tar.gz
Save to DB then send email
Separate the saving of the token from its sending.
Diffstat (limited to 'gn_auth/auth')
-rw-r--r--gn_auth/auth/authorisation/users/views.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/gn_auth/auth/authorisation/users/views.py b/gn_auth/auth/authorisation/users/views.py
index 839111e..ba74ab0 100644
--- a/gn_auth/auth/authorisation/users/views.py
+++ b/gn_auth/auth/authorisation/users/views.py
@@ -407,16 +407,17 @@ def send_forgot_password_email(
timedelta(
minutes=expiration_minutes)).timestamp())
})
- send_message(smtp_user=current_app.config["SMTP_USER"],
- smtp_passwd=current_app.config["SMTP_PASSWORD"],
- message=build_email_message(
- from_address=current_app.config["EMAIL_ADDRESS"],
- to_addresses=(user_address(user),),
- subject=subject,
- txtmessage=__render__("emails/forgot-password.txt"),
- htmlmessage=__render__("emails/forgot-password.html")),
- host=current_app.config["SMTP_HOST"],
- port=current_app.config["SMTP_PORT"])
+
+ send_message(smtp_user=current_app.config["SMTP_USER"],
+ smtp_passwd=current_app.config["SMTP_PASSWORD"],
+ message=build_email_message(
+ from_address=current_app.config["EMAIL_ADDRESS"],
+ to_addresses=(user_address(user),),
+ subject=subject,
+ txtmessage=__render__("emails/forgot-password.txt"),
+ htmlmessage=__render__("emails/forgot-password.html")),
+ host=current_app.config["SMTP_HOST"],
+ port=current_app.config["SMTP_PORT"])
@users.route("/forgot-password", methods=["GET", "POST"])