X-Git-Url: https://scm.cri.ensmp.fr/git/Plinn.git/blobdiff_plain/125a6289be7a631a256f948bda5415451aca6d98..98e7c46baa1b613b9b137c8478f99da593fdc46b:/skins/generic/password_reset_form.py diff --git a/skins/generic/password_reset_form.py b/skins/generic/password_reset_form.py index b783b63..dce99eb 100644 --- a/skins/generic/password_reset_form.py +++ b/skins/generic/password_reset_form.py @@ -1,19 +1,37 @@ ##parameters=validate='' from Products.CMFCore.utils import getUtilityByInterfaceName +from Products.Plinn.utils import Message as _ utool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IURLTool') atool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IActionsTool') form = context.REQUEST.form uuid = traverse_subpath[0] +passwordChanged = False + if validate and \ - context.validatePassword(**form) and \ - context.reset_password_control(uuid=uuid, **form) and \ - context.setRedirect(atool, 'user/join', ajax=form.get('ajax')) : - return + context.validatePassword(**form) : + userid = context.reset_password_control(uuid=uuid, **form) + if userid : + passwordChanged = True options = {} options['uuid'] = uuid -options['action'] = '%s/password_reset_form/%s' % (utool(), uuid) +options['passwordChanged'] = passwordChanged +if passwordChanged : + hidden_vars = ({'name' : '__ac_name', 'value' : userid}, + {'name' : '__ac_password', 'value' : form['password']}, + {'name' : 'noAjax', 'value' : '1'}) + target = utool() + buttons = ({'name': 'login', 'value': _(' Login ')},) +else : + hidden_vars = [] + target = '%s/password_reset_form/%s' % (utool(), uuid) + buttons = ({'name': 'validate', 'value': _('Validate')},) + +options['form'] = { 'action': target, + 'listButtonInfos': tuple(buttons), + 'listHiddenVarInfos': hidden_vars } + return context.password_reset_template(**options) \ No newline at end of file