From e1d011a3b1fec8d7adad7c03e3cc795a17ab01a2 Mon Sep 17 00:00:00 2001 From: Gabriel Monnerat <gabriel@tiolive.com> Date: Thu, 3 Mar 2011 19:54:07 +0000 Subject: [PATCH] implemented code to check if an user was created correctly git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43952 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../ERP5Site_getUserValidationState.xml | 81 +++++++++++++++++++ .../erp5_web_ung_theme/ung_js/ung.js.xml | 35 +++++++- bt5/erp5_web_ung_theme/bt/revision | 2 +- 3 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ERP5Site_getUserValidationState.xml diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ERP5Site_getUserValidationState.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ERP5Site_getUserValidationState.xml new file mode 100644 index 0000000000..5c8a0f4742 --- /dev/null +++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ERP5Site_getUserValidationState.xml @@ -0,0 +1,81 @@ +<?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>import json\n +\n +portal = context.getPortalObject()\n +person = portal.portal_catalog.getResultValue(portal_type="Person",\n + validation_state="validated",\n + **kw)\n +return json.dumps(dict(response=(person is not None)))\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>**kw</string> </value> + </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <tuple> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ERP5Site_getUserValidationState</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_js/ung.js.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_js/ung.js.xml index 6277ae07eb..77620d8948 100644 --- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_js/ung.js.xml +++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_js/ung.js.xml @@ -104,22 +104,51 @@ function changeCheckBoxValue(value){\n });\n }\n \n +function waitCreateUNGUser(paramStr){\n + $.get("ERP5Site_getUserValidationState?" + paramStr, {}, function(data, textStatus, XMLHttpRequest){\n + data = jQuery.parseJSON(data);\n + if (data.response == true){\n + clearTimeout();\n + setTimeout(window.location.reload(), 2000);\n + }\n + else {\n + setTimeout(waitCreateUNGUser(paramStr), 2000);\n + }\n + });\n +}\n +\n function displayLoginForm(){\n - $("a.ung_docs, img[alt=\'calendar_logo_box\'], table#create-new-user").hide();\n + $("a.ung_docs, img[alt=\'calendar_logo_box\'], table#create-new-user, img[alt=\'mail_logo_box\']").hide();\n $("div.header-left div.field input, div.main-right, div.main-left").hide();\n $.get("WebSection_loginDialog", function(data){\n $("div.header-left fieldset.widget").append("<p>" + data + "</p>");\n $("td#new-account-form").click(function(event){\n $("table#field_table, table#new-account-table").hide();\n + $("table#create-new-user input[type=\'text\'], table#create-new-user input[type=\'password\']").each(function(){\n + $(this).attr("value", "");\n + });\n $("table#create-new-user").show();\n $("form#create-user").submit(function(event){\n event.preventDefault();\n + var formHash = {};\n + var paramList = $("form#create-user").serializeArray();\n + for (var i=0; i < paramList.length; i++){\n + formHash[paramList[i].name] = paramList[i].value;\n + }\n + if (formHash.password != formHash.confirm){\n + $("td#form-message").text("Please confirm your password correctly..");\n + $("td#form-message").fadeIn(300).delay(800).fadeOut(1000);\n + return false;\n + }\n $.ajax({\n type: \'post\',\n url: \'ERPSite_createUNGUser\',\n data: $("form#create-user").serializeArray(),\n dataType: "json",\n });\n + var paramStr = "first_name=" + formHash.firstname +\n + "&" + "last_name=" + formHash.lastname;\n + setTimeout(waitCreateUNGUser(paramStr), 2000);\n });\n });\n });\n @@ -469,6 +498,10 @@ $().ready(function(){\n $("div.header-right").css("width", "52.3%");\n };\n $("a.tree-open").parent().parent().css("background-color", "#BBCCFF");\n + if (window.location.href.match("^http.*\\/unfoldDomain") != null){\n + $("a.document").css("text-decoration", "none")\n + .css("color", "#000");\n + }\n return false;\n }); diff --git a/bt5/erp5_web_ung_theme/bt/revision b/bt5/erp5_web_ung_theme/bt/revision index 02225a563f..a36df4ef7e 100644 --- a/bt5/erp5_web_ung_theme/bt/revision +++ b/bt5/erp5_web_ung_theme/bt/revision @@ -1 +1 @@ -268 \ No newline at end of file +269 \ No newline at end of file -- 2.30.9