Commit 9b81de97 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

erp5_credential: search email address and login with exact match

also add a missing return for Base_redirect.
parent ce44886c
...@@ -71,11 +71,11 @@ document_reference = None\n ...@@ -71,11 +71,11 @@ document_reference = None\n
if default_email_text is not None:\n if default_email_text is not None:\n
# Case for recovery of username\n # Case for recovery of username\n
if person_list is None:\n if person_list is None:\n
query_kw = {"email.url_string" : default_email_text}\n query_kw = {\'email.url_string\':{\'query\':default_email_text, \'key\':\'ExactMatch\'}}\n
result = portal.portal_catalog(portal_type="Email", parent_portal_type="Person", **query_kw)\n result = portal.portal_catalog(portal_type="Email", parent_portal_type="Person", **query_kw)\n
if len(result) == 0:\n if len(result) == 0:\n
portal_status_message = portal.Base_translateString("Can\'t find corresponding person, it\'s not possible to update your credentials.")\n portal_status_message = portal.Base_translateString("Can\'t find corresponding person, it\'s not possible to update your credentials.")\n
if web_site:\n if web_site is not None:\n
return web_site.Base_redirect(\'login_form\', keep_items = dict(portal_status_message=portal_status_message ))\n return web_site.Base_redirect(\'login_form\', keep_items = dict(portal_status_message=portal_status_message ))\n
return portal.Base_redirect(\'login_form\', keep_items = dict(portal_status_message=portal_status_message ))\n return portal.Base_redirect(\'login_form\', keep_items = dict(portal_status_message=portal_status_message ))\n
\n \n
...@@ -93,11 +93,11 @@ else:\n ...@@ -93,11 +93,11 @@ else:\n
# Case for recovery of password\n # Case for recovery of password\n
if person_list is None:\n if person_list is None:\n
person_module = portal.getDefaultModule(\'Person\')\n person_module = portal.getDefaultModule(\'Person\')\n
result = person_module.searchFolder(reference=reference)\n result = person_module.searchFolder(reference={\'query\':reference, \'key\':\'ExactMatch\'})\n
if len(result) != 1:\n if len(result) != 1:\n
portal_status_message = portal.Base_translateString("Can\'t find corresponding person, it\'s not possible to recover your credentials.")\n portal_status_message = portal.Base_translateString("Can\'t find corresponding person, it\'s not possible to recover your credentials.")\n
if web_site:\n if web_site is not None:\n
web_site.Base_redirect(\'\', keep_items = dict(portal_status_message=portal_status_message ))\n return web_site.Base_redirect(\'\', keep_items = dict(portal_status_message=portal_status_message ))\n
return portal.Base_redirect(\'\', keep_items = dict(portal_status_message=portal_status_message ))\n return portal.Base_redirect(\'\', keep_items = dict(portal_status_message=portal_status_message ))\n
\n \n
person_list = [result[0].getObject(),]\n person_list = [result[0].getObject(),]\n
...@@ -132,7 +132,7 @@ else:\n ...@@ -132,7 +132,7 @@ else:\n
\'reference\': reference}\n \'reference\': reference}\n
\n \n
keep_items[\'portal_status_message\'] = portal.Base_translateString(message)\n keep_items[\'portal_status_message\'] = portal.Base_translateString(message)\n
if web_site:\n if web_site is not None:\n
return web_site.Base_redirect(form_id=\'login_form\', keep_items=keep_items)\n return web_site.Base_redirect(form_id=\'login_form\', keep_items=keep_items)\n
return portal.Base_redirect(form_id=\'login_form\', keep_items=keep_items)\n return portal.Base_redirect(form_id=\'login_form\', keep_items=keep_items)\n
</string> </value> </string> </value>
......
432 433
\ 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