[password-resets] Revert "Let it fail (again)"



commit 5cff2decf3d14968aa726d1b8fa94aad931bde4d
Author: Andrea Veri <averi redhat com>
Date:   Mon Nov 23 13:42:40 2020 +0100

    Revert "Let it fail (again)"
    
    This reverts commit 517a9cab261252a88121e77e6540e119893372c7.

 app.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/app.py b/app.py
index 36ec3fb..b59375c 100644
--- a/app.py
+++ b/app.py
@@ -96,18 +96,18 @@ def form_reset_post(request: Request, token: str, password: str = Form(...)):
 
     t = Session.query(Token).filter(Token.token==token).first()
     if t:
-        #try:
-        glu.replace_ldap_password(t.username, newpassword['userPassword'])
+        try:
+            glu.replace_ldap_password(t.username, newpassword['userPassword'])
 
-        t.claimed = 1
-        Session.commit()
-        Session.remove()
+            t.claimed = 1
+            Session.commit()
+            Session.remove()
 
-        #    return templates.TemplateResponse('general-form.html', context={'request': request, 
'passwordsuccess': True})
-        #except:
-        #    Session.remove()
+            return templates.TemplateResponse('general-form.html', context={'request': request, 
'passwordsuccess': True})
+        except:
+            Session.remove()
 
-        #    return templates.TemplateResponse('general-form.html', context={'request': request, 
'passworderror': True})
+            return templates.TemplateResponse('general-form.html', context={'request': request, 
'passworderror': True})
 
 def send_email(email, token):
     import imghdr


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