Back to index

plone3  3.1.7
change_password.py
Go to the documentation of this file.
00001 ## Script (Python) "change_password"
00002 ##bind container=container
00003 ##bind context=context
00004 ##bind namespace=
00005 ##bind script=script
00006 ##bind subpath=traverse_subpath
00007 ##parameters=password, confirm, domains=None
00008 ##title=Change password
00009 ##
00010 
00011 pass
00012 
00013 ## This code is there because there's a bug in CMF that prevents
00014 ## passwords to be changed if the User Folder doesn't store it in a __
00015 ## attribute.
00016 ## This includes User Folders such as LDAPUF, SimpleUF, and, of course, GRUF.
00017 ## This also includes standard UF with password encryption !
00018 
00019 mt = context.portal_membership
00020 failMessage=context.portal_registration.testPasswordValidity(password, confirm)
00021 
00022 if failMessage:
00023     return context.password_form(context,
00024                                  context.REQUEST,
00025                                  error=failMessage)
00026 context.REQUEST['AUTHENTICATED_USER'].changePassword(password,REQUEST=context.REQUEST)
00027 mt.credentialsChanged(password)
00028 return context.personalize_form(context,
00029                                 context.REQUEST,
00030                                 portal_status_message='Password changed.')
00031