[CMF-checkins] CVS: CMF/CMFDefault - RegistrationTool.py:1.13

Florent Guillaume fg@nuxeo.com
Sat, 29 Jun 2002 11:02:26 -0400


Update of /cvs-repository/CMF/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv4660/CMFDefault

Modified Files:
	RegistrationTool.py 
Log Message:
Fixed CMFDefault.RegistrationTool to correctly check the lack of 'email'
property when creating a new member or when checking member's properties
validity (Tracker #508).

The fix ensures that the 'email' property is filled in at Join time, and
that a user is not allowed to clear his email (the policy in CMFDefault
seems to be that all members have an email).

I keep the possibility of a user leaving an already-empty password blank
when changing his preferences (for instance if it was removed by the
administrator for some reason, the user can still go change his other
properties).



=== CMF/CMFDefault/RegistrationTool.py 1.12 => 1.13 ===
 
             if not self.isMemberIdAllowed(username):
-                return ( 'The login name you selected is already ' 
-                       + 'in use or is not valid. Please choose another.'
-                       )
-        if not (props.get('email') or member.getProperty('email')):
-            return 'You must enter a valid email address.'
+                raise ('The login name you selected is already '
+                       'in use or is not valid. Please choose another.')
+
+            if not props.get('email'):
+                return 'You must enter a valid email address.'
+
+        else: # Existing member.
+            # Not allowed to clear an existing non-empty email.
+            if (member.getProperty('email') and
+                not props.get('email', 'NoPropIsOk')):
+                return 'You must enter a valid email address.'
 
         return None