Commit 40f40381 authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_core: prevent reset-password form's validation to raise

when form is used in another context (web section for exemple).
parent e9b0837d
...@@ -15,7 +15,11 @@ password_key = request.get('field_your_password_key', ...@@ -15,7 +15,11 @@ password_key = request.get('field_your_password_key',
request.get('your_password_key')) request.get('your_password_key'))
assert password_key assert password_key
validation_message_list = context.analyzePassword(editor, password_key) # Explicitely get Password Tool, as we cannot be sure that the context
# is 100% of the time Password Tool (developers may want to include the
# PasswordTool_viewResetPassword form in their own website to not
# duplicate code).
validation_message_list = context.getPortalObject().portal_password.analyzePassword(editor, password_key)
if validation_message_list: if validation_message_list:
message = u' '.join([str(x) for x in validation_message_list]) message = u' '.join([str(x) for x in validation_message_list])
raise ValidationError('external_validator_failed', context, error_text=message) raise ValidationError('external_validator_failed', context, error_text=message)
......
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