Commit 26acca0e authored by Jérome Perrin's avatar Jérome Perrin

- clear corresponding cache after changing password

- translate message when redirecting

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24847 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 621baabc
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from AccessControl import getSecurityManager\n <value> <string>from AccessControl import getSecurityManager\n
from Products.ERP5Type.Message import translateString\n
\n \n
request = context.REQUEST\n request = context.REQUEST\n
new_password = request.get("new_password")\n new_password = request.get("new_password")\n
...@@ -64,14 +65,16 @@ persons = context.acl_users.erp5_users.getUserByLogin(user)\n ...@@ -64,14 +65,16 @@ persons = context.acl_users.erp5_users.getUserByLogin(user)\n
person = persons[0]\n person = persons[0]\n
\n \n
if not person.checkPassword(former_password):\n if not person.checkPassword(former_password):\n
msg = "Current password is wrong."\n msg = translateString("Current password is wrong.")\n
else:\n else:\n
msg = "Password changed."\n msg = translateString("Password changed.")\n
person.setPassword(new_password)\n person.setPassword(new_password)\n
\n \n
ret_url = \'/\'.join([context.absolute_url(), request.get(\'form_id\', \'view\')])\n # clear erp5_content_short cache (see _authenticateCredentials in Products.ERP5Security.ERP5UserManager)\n
response = request.response\n context.portal_caches.clearCache((\'erp5_content_short\',))\n
response.redirect("%s?portal_status_message=%s" % (ret_url, msg))\n \n
return context.Base_redirect(form_id,\n
keep_items=dict(portal_status_message=msg))\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -82,7 +85,7 @@ response.redirect("%s?portal_status_message=%s" % (ret_url, msg))\n ...@@ -82,7 +85,7 @@ response.redirect("%s?portal_status_message=%s" % (ret_url, msg))\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>form_id=\'view\', **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
...@@ -110,15 +113,18 @@ response.redirect("%s?portal_status_message=%s" % (ret_url, msg))\n ...@@ -110,15 +113,18 @@ response.redirect("%s?portal_status_message=%s" % (ret_url, msg))\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>form_id</string>
<string>kw</string> <string>kw</string>
<string>AccessControl</string> <string>AccessControl</string>
<string>getSecurityManager</string> <string>getSecurityManager</string>
<string>Products.ERP5Type.Message</string>
<string>translateString</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>request</string> <string>request</string>
...@@ -129,8 +135,7 @@ response.redirect("%s?portal_status_message=%s" % (ret_url, msg))\n ...@@ -129,8 +135,7 @@ response.redirect("%s?portal_status_message=%s" % (ret_url, msg))\n
<string>_getitem_</string> <string>_getitem_</string>
<string>person</string> <string>person</string>
<string>msg</string> <string>msg</string>
<string>ret_url</string> <string>dict</string>
<string>response</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -142,7 +147,9 @@ response.redirect("%s?portal_status_message=%s" % (ret_url, msg))\n ...@@ -142,7 +147,9 @@ response.redirect("%s?portal_status_message=%s" % (ret_url, msg))\n
<item> <item>
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<none/> <tuple>
<string>view</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
1033 1034
\ No newline at end of file \ No newline at end of file
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