plugin misc_account: fixed password verification

This commit is contained in:
souliane 2015-11-27 11:21:51 +01:00
commit 6934269002

View file

@ -332,7 +332,7 @@ http://www.salut-a-toi.org
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 @@ http://www.salut-a-toi.org
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 @@ http://www.salut-a-toi.org
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 @@ http://www.salut-a-toi.org
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)