Commit f3b88846 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Test password before reset it and give feedback when password...

slapos_jio: Test password before reset it and give feedback when password don't comply with the policy
parent 6164c44e
Pipeline #9757 failed with stage
in 0 seconds
"""
The method changeUserPassword ignore came_from if you are in the Web Site context.
"""
REQUEST = context.REQUEST
error_list = context.portal_password.analyzePassword(
REQUEST['password'], REQUEST['password_key']
)
if error_list:
error_message = context.Base_translateString("Password don't comply with policy: ")
error_message += ", ".join([context.Base_translateString(i.message) for i in error_list])
return REQUEST.RESPONSE.redirect(
"%s/WebSite_viewResetPassword?reset_key=%s&portal_status_message=%s" % \
(REQUEST["came_from"], REQUEST['password_key'], error_message))
next_url = context.portal_password.changeUserPassword(password=REQUEST['password'],
password_confirmation=REQUEST['password_confirm'],
password_key=REQUEST['password_key'],
user_login=REQUEST.get('user_login', None),
REQUEST=REQUEST)
root_url = "%s/" % context.getWebSiteValue().absolute_url()
return REQUEST.RESPONSE.redirect("%s&came_from=%s" % (next_url, root_url))
<?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>_params</string> </key>
<value> <string>*args, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PasswordTool_changeUserPassword</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