Commit 86818ca8 authored by Jérome Perrin's avatar Jérome Perrin

fixup! redirection does not works after change password. so logout the user.

When current password was incorrect we still have to redirect

Conflicts:
	product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/PreferenceTool_setNewPassword.xml
parent ac38514b
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from AccessControl import getSecurityManager\n
from Products.ERP5Type.Message import translateString\n
\n
request = context.REQUEST\n
new_password = request.get("new_password")\n
former_password = request.get("current_password")\n
\n
user = getSecurityManager().getUser()\n
persons = context.acl_users.erp5_users.getUserByLogin(user)\n
person = persons[0]\n
\n
if not person.checkPassword(former_password):\n
msg = translateString("Current password is wrong.")\n
return context.Base_redirect(form_id, keep_items={\'portal_status_message\': msg})\n
\n
person.setPassword(new_password)\n
\n
# clear erp5_content_short cache (see _authenticateCredentials in Products.ERP5Security.ERP5UserManager)\n
context.portal_caches.clearCache((\'erp5_content_short\',))\n
return context.logout()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form_id=\'view\', **kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PreferenceTool_setNewPassword</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment