changeset 5940:1960726cd356

set_password: warn if user has no e-mail address in the profile
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 29 Jan 2013 19:39:34 +0100
parents 24054d620fc1
children db8fd396ec54
files MoinMoin/user.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/user.py	Fri Jan 25 23:01:33 2013 +0100
+++ b/MoinMoin/user.py	Tue Jan 29 19:39:34 2013 +0100
@@ -187,6 +187,9 @@
 class NoSuchUser(Fault):
     """raised if no such user exists"""
 
+class UserHasNoEMail(Fault):
+    """raised if user has no e-mail address in his profile"""
+
 class MailFailed(Fault):
     """raised if e-mail sending failed"""
 
@@ -205,6 +208,8 @@
         else:
             u.enc_password = encodePassword(request.cfg, newpass)
         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:
             mailok, msg = u.mailAccountData(subject=subject,
                                             text_intro=text_intro, text_msg=text_msg, text_data=text_data)