Tabs -> 4 × spaces
[Plinn.git] / skins / control / edit_member_settings.py
1 ##parameters=username, password='', confirm='', ajax=''
2
3 from ZTUtils import make_query as mq
4 portal_url = context.portal_url()
5 rtool = context.portal_registration
6 req=context.REQUEST
7 resp = req.RESPONSE
8 member = context.portal_membership.getMemberById(username)
9
10 failMessage = rtool.testPropertiesValidity(req, member)
11 if failMessage:
12 return resp.redirect(portal_url + '/portal_members?%s' % mq(portal_status_message=failMessage,
13 member_id=username,
14 macroName='member_properties_form',
15 ajax=ajax))
16
17 member.setMemberProperties(req.form)
18
19 if password :
20 failMessage = rtool.testPasswordValidity(password, confirm=confirm)
21 if failMessage:
22 return resp.redirect(portal_url + '/portal_members?%s' % mq(portal_status_message=failMessage,
23 member_id=username,
24 macroName='member_properties_form',
25 ajax=ajax))
26 else :
27 member.setMemberPassword(password)
28
29 return resp.redirect(portal_url + '/portal_members?%s' % mq(portal_status_message='Member modified.', ajax=ajax))