From 2b383e8168ca0b4a86511b84e9806845d966ee16 Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Fri, 26 Nov 2010 12:40:46 +0000 Subject: [PATCH] Make sure email (or actually reference in KM context) uniqueness check happens at registration form level. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40777 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_km/Base_isReferenceUnique.xml | 142 ++++++++++++++++++ .../login_form/your_default_email_text.xml | 30 +++- bt5/erp5_km/bt/revision | 2 +- 3 files changed, 172 insertions(+), 2 deletions(-) create mode 100644 bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km/Base_isReferenceUnique.xml diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km/Base_isReferenceUnique.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km/Base_isReferenceUnique.xml new file mode 100644 index 0000000000..4d79431244 --- /dev/null +++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km/Base_isReferenceUnique.xml @@ -0,0 +1,142 @@ +<?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>"""\n + External validator for login_form\n + that checks that reference is unique into the system.\n +"""\n +kw={\'reference\': editor,\n + \'portal_type\': [\'Person\', \'Credential Request\']}\n +email = context.portal_catalog.getResultValue(**kw)\n +if email is not None:\n + return 0\n +return 1\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>editor, request</string> </value> + </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <tuple> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>2</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>editor</string> + <string>request</string> + <string>kw</string> + <string>_apply_</string> + <string>_getattr_</string> + <string>context</string> + <string>email</string> + <string>None</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Base_isReferenceUnique</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form/your_default_email_text.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form/your_default_email_text.xml index 8d1309090d..9d3e2fac95 100644 --- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form/your_default_email_text.xml +++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form/your_default_email_text.xml @@ -11,6 +11,15 @@ <value> <list> <string>enabled</string> + <string>external_validator</string> + </list> + </value> + </item> + <item> + <key> <string>delegated_message_list</string> </key> + <value> + <list> + <string>external_validator_failed</string> </list> </value> </item> @@ -24,7 +33,7 @@ <dictionary> <item> <key> <string>external_validator_failed</string> </key> - <value> <string>The input failed the external validator.</string> </value> + <value> <string>Email is already used into the system. Please try new one.</string> </value> </item> </dictionary> </value> @@ -81,6 +90,12 @@ <key> <string>enabled</string> </key> <value> <int>1</int> </value> </item> + <item> + <key> <string>external_validator</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> <item> <key> <string>field_id</string> </key> <value> <string>your_default_email_text</string> </value> @@ -112,4 +127,17 @@ </dictionary> </pickle> </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="Method" module="Products.Formulator.MethodField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>method_name</string> </key> + <value> <string>Base_isReferenceUnique</string> </value> + </item> + </dictionary> + </pickle> + </record> </ZopeData> diff --git a/bt5/erp5_km/bt/revision b/bt5/erp5_km/bt/revision index 3a2ac0e3fa..9b21444cdb 100644 --- a/bt5/erp5_km/bt/revision +++ b/bt5/erp5_km/bt/revision @@ -1 +1 @@ -1701 \ No newline at end of file +1703 \ No newline at end of file -- 2.30.9