[password-resets] Drop the sqlalchemy session now that we validated another token is present



commit 75d531c5b09e5b82f579e6cf38fadc83de088aaf
Author: Andrea Veri <averi redhat com>
Date:   Mon Nov 23 13:04:50 2020 +0100

    Drop the sqlalchemy session now that we validated another token is present

 app.py | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/app.py b/app.py
index aa357c8..e0411f1 100644
--- a/app.py
+++ b/app.py
@@ -56,6 +56,8 @@ def form_post(request: Request, username: str = Form(...)):
     if mail:
         tokens = Session.query(Token.username, Token.expired, 
Token.claimed).filter(Token.username==username, Token.expired==0, Token.claimed==0)
         if len(list(tokens)) == 1:
+            Session.remove()
+
             return templates.TemplateResponse('general-form.html', context={'request': request, 'badtoken': 
True})
 
         date = datetime.datetime.now()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]