a08d980a4c3b4b84fca311cfd9bac05c895f0890
[Plinn.git] / skins / generic / request_password_reset_form.py
1 ##parameters=userid='', requestReset='', ajax=''
2 from Products.CMFCore.utils import getUtilityByInterfaceName
3 from Products.Plinn.utils import translate
4
5 _ = lambda msg : translate(msg, context)
6 utool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IURLTool')
7 rtool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IRegistrationTool')
8
9 if requestReset :
10 msg = rtool.requestPasswordReset(userid)
11 if not msg :
12 context.setStatus(True, _('Request for resetting password sent to your contact email.'))
13 context.setRedirect(utool.getPortalObject(), 'object/view', ajax=ajax)
14 return
15
16 context.setStatus(False, msg)
17
18 options={}
19 target = '%s/request_password_reset_form' % utool()
20 options['action'] = target
21
22 return context.request_password_reset_template(**options)