[commits] r76 -
selinux-site/trunk/selinux.theme/selinux/theme/skins/selinuxtheme
jens at mail.se.linux.org
jens at mail.se.linux.org
Sön Juli 22 13:01:23 CEST 2007
Author: jens
Date: 2007-07-22 13:01:23 +0200 (Sun, 22 Jul 2007)
New Revision: 76
Added:
selinux-site/trunk/selinux.theme/selinux/theme/skins/selinuxtheme/join_form_validate.vpy
Log:
OBS: Fungerar inte ?\195?\164n!
Added: selinux-site/trunk/selinux.theme/selinux/theme/skins/selinuxtheme/join_form_validate.vpy
===================================================================
--- selinux-site/trunk/selinux.theme/selinux/theme/skins/selinuxtheme/join_form_validate.vpy 2007-07-22 09:06:33 UTC (rev 75)
+++ selinux-site/trunk/selinux.theme/selinux/theme/skins/selinuxtheme/join_form_validate.vpy 2007-07-22 11:01:23 UTC (rev 76)
@@ -0,0 +1,66 @@
+## Controller Python Script "validate_registration"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind state=state
+##bind subpath=traverse_subpath
+##parameters=username='',email='',password='',password_confirm='',givenname='',surname='',postadress='',postnr='',location=''
+##title=validates the Registration of a User
+
+from Products.CMFPlone import PloneMessageFactory as _
+
+reg_tool=context.portal_registration
+def missing(field):
+ state.setError(field, _(u'This field is required, please provide some information.'), 'input_required')
+def nomatch(field):
+ state.setError(field, _(u'Passwords do not match.'), 'nomatch_password')
+def minlimit(field):
+ state.setError(field, _(u'Passwords must contain at least 5 letters.'), 'min_password')
+def notallowed(field):
+ state.setError(field, _(u'This username is reserved. Please choose a different name.'), 'not_allowed')
+
+if not username:
+ missing('username')
+if not email:
+ missing('email')
+if not givenname:
+ missing('givenname')
+if not surname:
+ missing('surname')
+if not postadress:
+ missing('postadress')
+if not postnr:
+ missing('postnr')
+if not location:
+ missing('location')
+
+if username and username == context.portal_url.getPortalObject().getId():
+ notallowed('username')
+
+properties = context.portal_properties.site_properties
+if not properties.validate_email:
+ if password!=password_confirm:
+ nomatch('password')
+ nomatch('password_confirm')
+
+ if not password:
+ missing('password')
+ if not password_confirm:
+ missing('password_confirm')
+
+ if not state.getError('password') and len(password) < 5:
+ minlimit('password')
+ minlimit('password_confirm')
+
+if not state.getError('username') and not reg_tool.isMemberIdAllowed(username):
+ state.setError('username',
+ _(u'The login name you selected is already in use or is not valid. Please choose another.'),
+ 'username_invalid' )
+
+if state.getErrors():
+ context.plone_utils.addPortalMessage(_(u'Please correct the indicated errors.'), 'error')
+ return state.set(status='failure')
+else:
+ context.plone_utils.addPortalMessage(_(u'You have been registered.'))
+ return state
Property changes on: selinux-site/trunk/selinux.theme/selinux/theme/skins/selinuxtheme/join_form_validate.vpy
___________________________________________________________________
Name: svn:executable
+ *
More information about the commits
mailing list