aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-08-20 15:20:11 -0500
committerFrederick Muriuki Muriithi2024-08-20 15:21:22 -0500
commit3b1ebec9c030f18ad424afa252c2ed98e985aad3 (patch)
tree582c41858f0bd430cb6815ba7dfafb1cf4ae4169
parent1c2db3df6d8417cb927e0b47774dcdd6397f5469 (diff)
downloadgn-auth-3b1ebec9c030f18ad424afa252c2ed98e985aad3.tar.gz
Fix query: Replace any existing token.
-rw-r--r--gn_auth/auth/authorisation/users/views.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/gn_auth/auth/authorisation/users/views.py b/gn_auth/auth/authorisation/users/views.py
index 84d7ef0..3083724 100644
--- a/gn_auth/auth/authorisation/users/views.py
+++ b/gn_auth/auth/authorisation/users/views.py
@@ -385,10 +385,9 @@ def send_forgot_password_email(conn, user: User):
with db.cursor(conn) as cursor:
cursor.execute(
- ("INSERT INTO "
+ ("INSERT OR REPLACE INTO "
"forgot_password_tokens(user_id, token, generated, expires) "
- "VALUES (:user_id, :token, :generated, :expires) "
- "ON CONFLICT (user_id) REPLACE"),
+ "VALUES (:user_id, :token, :generated, :expires)"),
{
"user_id": str(user.user_id),
"token": token,