Éléments déplacés vers le produit photoprint.
[Plinn.git] / skins / generic / password_reset_form.py
1 ##parameters=validate=''
2 from Products.CMFCore.utils import getUtilityByInterfaceName
3 from Products.Plinn.utils import Message as _
4 utool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IURLTool')
5 atool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IActionsTool')
6
7 form = context.REQUEST.form
8 uuid = traverse_subpath[0]
9
10 passwordChanged = False
11
12 if validate and \
13 context.validatePassword(**form) :
14 userid = context.reset_password_control(uuid=uuid, **form)
15 if userid :
16 passwordChanged = True
17
18 options = {}
19 options['uuid'] = uuid
20 options['passwordChanged'] = passwordChanged
21 if passwordChanged :
22 hidden_vars = ({'name' : '__ac_name', 'value' : userid},
23 {'name' : '__ac_password', 'value' : form['password']},
24 {'name' : 'noAjax', 'value' : '1'})
25 target = utool()
26 buttons = ({'name': 'login', 'value': _(' Login ')},)
27 else :
28 hidden_vars = []
29 target = '%s/password_reset_form/%s' % (utool(), uuid)
30 buttons = ({'name': 'validate', 'value': _('Update Password')},)
31
32 options['form'] = { 'action': target,
33 'listButtonInfos': tuple(buttons),
34 'listHiddenVarInfos': hidden_vars }
35
36
37 return context.password_reset_template(**options)