Déplacement pour eggification.
[Plinn.git] / Products / Plinn / skins / custom_control / change_password.py
diff --git a/Products/Plinn/skins/custom_control/change_password.py b/Products/Plinn/skins/custom_control/change_password.py
new file mode 100755 (executable)
index 0000000..ac613d7
--- /dev/null
@@ -0,0 +1,14 @@
+##parameters=password, confirm, domains=None, ajax=''
+from ZTUtils import make_query as mq
+url = context.portal_url()
+red = context.REQUEST.RESPONSE.redirect
+
+mt = context.portal_membership
+failMessage=context.portal_registration.testPasswordValidity(password, confirm)
+if failMessage:
+       return red('%s/password_form?%s' % (url, mq(portal_status_message=failMessage, ajax=ajax)))
+
+member = mt.getAuthenticatedMember()
+mt.setPassword(password, domains)
+mt.credentialsChanged(password)
+return red('%s/personalize_form?%s' % (url, mq(portal_status_message='Password changed.', ajax=ajax)))
\ No newline at end of file