diff src/plugins/plugin_misc_account.py @ 1691:cec204c6360c

plugin misc_account: fixed password verification
author souliane <souliane@mailoo.org>
date Fri, 27 Nov 2015 11:21:51 +0100
parents 200efadcab76
children 9a7a27c44611
line wrap: on
line diff
--- a/src/plugins/plugin_misc_account.py	Fri Nov 27 10:15:23 2015 +0100
+++ b/src/plugins/plugin_misc_account.py	Fri Nov 27 11:21:51 2015 +0100
@@ -332,7 +332,7 @@
 
         def error_ui(message=None):
             if not message:
-                D_("The provided profile password doesn't match.")
+                message = D_("The provided profile password doesn't match.")
             error_ui = xml_tools.XMLUI("popup", title=D_("Attempt failure"))
             error_ui.addText(message)
             return {'xmlui': error_ui.toXml()}
@@ -341,7 +341,9 @@
         delete_passwd = data[xml_tools.SAT_FORM_PREFIX + 'delete_passwd']
         delete_checkbox = data[xml_tools.SAT_FORM_PREFIX + 'delete_checkbox']
         if delete_checkbox == 'true':
-            if verify(delete_passwd):
+            verified = yield verify(delete_passwd)
+            assert isinstance(verified, bool)
+            if verified:
                 defer.returnValue(self.__deleteAccount(profile))
             defer.returnValue(error_ui())
 
@@ -353,7 +355,9 @@
             posts = delete_posts_checkbox == 'true'
             comments = delete_comments_checkbox == 'true'
             if posts or comments:
-                if verify(delete_posts_passwd):
+                verified = yield verify(delete_posts_passwd)
+                assert isinstance(verified, bool)
+                if verified:
                     defer.returnValue(self.__deleteBlogPosts(posts, comments, profile))
                 defer.returnValue(error_ui())
 
@@ -362,7 +366,9 @@
         new_passwd1 = data[xml_tools.SAT_FORM_PREFIX + 'new_passwd1']
         new_passwd2 = data[xml_tools.SAT_FORM_PREFIX + 'new_passwd2']
         if new_passwd1 or new_passwd2:
-            if verify(current_passwd):
+            verified = yield verify(current_passwd)
+            assert isinstance(verified, bool)
+            if verified:
                 if new_passwd1 == new_passwd2:
                     data = yield self.__changePassword(new_passwd1, profile=profile)
                     defer.returnValue(data)