Implémentation du mode anonyme avec mot de passe.
[Plinn.git] / skins / control / add_member.py
1 ##parameters=username, password, confirm, ajax=''
2 REQUEST = context.REQUEST
3 rtool = context.portal_registration
4 from ZTUtils import make_query as mq
5 url = context.portal_url()
6 red = REQUEST.RESPONSE.redirect
7
8 failMessage = rtool.testPasswordValidity(password, confirm)
9 if failMessage :
10 return red('%s/portal_members?%s' % (url, mq(portal_status_message = failMessage, ajax=ajax)))
11
12 failMessage = rtool.testPropertiesValidity(REQUEST.form)
13 if failMessage :
14 return red('%s/portal_members?%s' % (url, mq(portal_status_message = failMessage, ajax=ajax)))
15
16 context.portal_registration.addMember(username, password, roles=[], properties=REQUEST)
17 red('%s/portal_members?%s' % (url, mq(portal_status_message = 'Member created.', ajax=ajax)))