[sagenb] 44/179: set recovery password via user_manager

felix salfelder felix-guest at moszumanska.debian.org
Tue May 6 12:05:08 UTC 2014


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch master
in repository sagenb.

commit 17f17b71d30b740d15f005d5a77368e4af4ec148
Author: Robin Martinjak <rob at rmartinjak.de>
Date:   Tue Dec 4 00:39:12 2012 +0100

    set recovery password via user_manager
    
    Also set it only if sending the email succeeded, instead of setting it back to
    the old value if that failed.
---
 flask_version/authentication.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/flask_version/authentication.py b/flask_version/authentication.py
index 62966bf..788f9bb 100644
--- a/flask_version/authentication.py
+++ b/flask_version/authentication.py
@@ -301,7 +301,6 @@ def forgot_pass():
     chara = string.letters + string.digits
     old_pass = user.password()
     password = ''.join([choice(chara) for i in range(8)])
-    user.set_password(password)
 
     from sagenb.notebook.smtpsend import send_mail
     from sagenb.notebook.register import build_password_msg
@@ -316,8 +315,9 @@ def forgot_pass():
         send_mail(fromaddr, destaddr, "Sage Notebook Account Recovery", body)
     except ValueError:
         # the email address is invalid
-        user.set_password(old_pass)
         return error("The new password couldn't be sent."%destaddr)
+    else:
+        g.notebook.user_manager().set_password(username, password)
 
     return current_app.message("A new password has been sent to your e-mail address.", url_for('base.index'))
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagenb.git



More information about the debian-science-commits mailing list