Back to index

plone3  3.1.7
validatePassword.py
Go to the documentation of this file.
00001 ## Script (Python) "validatePassword"
00002 ##parameters=password='', confirm='', **kw
00003 ##title=
00004 ##
00005 from Products.CMFCore.utils import getUtilityByInterfaceName
00006 from Products.CMFCore.utils import getToolByName
00007 
00008 ptool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IPropertiesTool')
00009 rtool = getToolByName(script, 'portal_registration')
00010 
00011 if ptool.getProperty('validate_email'):
00012     password = rtool.generatePassword()
00013     return context.setStatus(True, password=password)
00014 else:
00015     result = rtool.testPasswordValidity(password, confirm)
00016     if result:
00017         return context.setStatus(False, result)
00018     else:
00019         return context.setStatus(True)