cd3f97f4b9cbd0c53bedb2cc1171bfc328e8f4b4
[GroupUserFolder.git] / skins / gruf / change_password.py
1 ## Script (Python) "change_password"
2 ##bind container=container
3 ##bind context=context
4 ##bind namespace=
5 ##bind script=script
6 ##bind subpath=traverse_subpath
7 ##parameters=password, confirm, domains=None
8 ##title=Change password
9 ##
10
11 pass
12
13 ## This code is there because there's a bug in CMF that prevents
14 ## passwords to be changed if the User Folder doesn't store it in a __
15 ## attribute.
16 ## This includes User Folders such as LDAPUF, SimpleUF, and, of course, GRUF.
17 ## This also includes standard UF with password encryption !
18
19 mt = context.portal_membership
20 failMessage=context.portal_registration.testPasswordValidity(password, confirm)
21
22 if failMessage:
23 return context.password_form(context,
24 context.REQUEST,
25 error=failMessage)
26 context.REQUEST['AUTHENTICATED_USER'].changePassword(password,REQUEST=context.REQUEST)
27 mt.credentialsChanged(password)
28 return context.personalize_form(context,
29 context.REQUEST,
30 portal_status_message='Password changed.')
31