+ security.declarePublic( 'testPasswordValidity' )
+ def testPasswordValidity(self, password, confirm=None):
+
+ """ Verify that the password satisfies the portal's requirements.
+
+ o If the password is valid, return None.
+ o If not, return a string explaining why.
+ """
+ if not password:
+ return _(u'You must enter a password.')
+
+ if len(password) < 8 and not _checkPermission(ManagePortal, self):
+ return _(u'Your password must contain at least 8 characters.')
+
+ if confirm is not None and confirm != password:
+ return _(u'Your password and confirmation did not match. '
+ u'Please try again.')
+
+ return None
+
+