changeset 2143:ed73c69d80c0

set_password: only check email if notify was requested, fix id KeyError
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 03 Oct 2013 15:12:00 +0200
parents 2e205b784aed
children 90ef29715d9e
files MoinMoin/script/account/resetpw.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/account/resetpw.py	Thu Oct 03 14:52:35 2013 +0200
+++ b/MoinMoin/script/account/resetpw.py	Thu Oct 03 15:12:00 2013 +0200
@@ -43,9 +43,9 @@
             return
         u.set_password(password)
         u.save()
-        if not u.email:
-            raise UserHasNoEMail('User profile does not have an E-Mail address (name: %r id: %r)!' % (u.name, u.id))
         if notify and not u.disabled:
+            if not u.email:
+                raise UserHasNoEMail('Notification was requested, but User profile does not have a validated E-Mail address (name: %r id: %r)!' % (u.name, u.itemid))
             mailok, msg = u.mail_password_recovery(subject=subject, text=text)
             if not mailok:
                 raise MailFailed(msg)