Localisation.
[Plinn.git] / skins / custom_control / change_password.py
1 ##parameters=password, confirm, domains=None, ajax=''
2 from ZTUtils import make_query as mq
3 url = context.portal_url()
4 red = context.REQUEST.RESPONSE.redirect
5
6 mt = context.portal_membership
7 failMessage=context.portal_registration.testPasswordValidity(password, confirm)
8 if failMessage:
9 return red('%s/password_form?%s' % (url, mq(portal_status_message=failMessage, ajax=ajax)))
10
11 member = mt.getAuthenticatedMember()
12 mt.setPassword(password, domains)
13 mt.credentialsChanged(password)
14 return red('%s/personalize_form?%s' % (url, mq(portal_status_message='Password changed.', ajax=ajax)))