From 19cbec14c2f77efb6d890e620f97d10ee992fa23 Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Fri, 26 Nov 2010 15:24:15 +0000
Subject: [PATCH] Make it possible to reset password using ERP5 credentials
 system.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40794 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_km_theme/km_js/erp5_km.js.xml        |  21 +-
 .../portal_skins/erp5_km_theme/login_form.xml |   6 +-
 .../erp5_km_theme/login_form/ac_password.xml  |   7 +-
 .../login_form/reset_password.xml             | 298 ++++++++++++++++++
 bt5/erp5_km/bt/revision                       |   2 +-
 5 files changed, 318 insertions(+), 16 deletions(-)
 create mode 100644 bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form/reset_password.xml

diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_js/erp5_km.js.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_js/erp5_km.js.xml
index d7493feece..d95b56bc63 100644
--- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_js/erp5_km.js.xml
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_js/erp5_km.js.xml
@@ -12,7 +12,7 @@
         </item>
         <item>
             <key> <string>_EtagSupport__etag</string> </key>
-            <value> <string>ts84965188.86</string> </value>
+            <value> <string>ts90783596.78</string> </value>
         </item>
         <item>
             <key> <string>__name__</string> </key>
@@ -75,10 +75,19 @@ function toggleHiddenFormatDialogSelection(){\n
 MochiKit.DOM.addLoadEvent(setScreenClass);\n
 connect(window, "onresize", setScreenClass);\n
 \n
-function setScreenClass(){\n
-  var fmt = document.documentElement.clientWidth;\n
-  var cls = (fmt<=800)?\'screen_small\':(fmt>800)?\'screen_wide\':\'screen_small\';\n
-  document.body.className=cls;\n
+// function setScreenClass(){\n
+//   var fmt = document.documentElement.clientWidth;\n
+//   var cls = (fmt<=800)?\'screen_small\':(fmt>800)?\'screen_wide\':\'screen_small\';\n
+//   document.body.className=cls;\n
+// };\n
+\n
+function requestPasswordReset(script_name){\n
+  MochiKit.DOM.getElement(\'reference\').value = MochiKit.DOM.getElement(\'__ac_name\').value;\n
+  /* reset __ac_name & __ac_password in case they have been filled by browser */\n
+  MochiKit.DOM.getElement(\'__ac_name\').value = "";\n
+  MochiKit.DOM.getElement(\'__ac_password\').value = "";\n
+  /* Submit request password */\n
+  submitAction(MochiKit.DOM.getElement(\'main_form\'), script_name);  \n
 };\n
 
 
@@ -90,7 +99,7 @@ function setScreenClass(){\n
         </item>
         <item>
             <key> <string>size</string> </key>
-            <value> <int>1787</int> </value>
+            <value> <int>2229</int> </value>
         </item>
         <item>
             <key> <string>title</string> </key>
diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form.xml
index 52f496eb74..0628c35d3a 100644
--- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form.xml
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form.xml
@@ -2,10 +2,7 @@
 <ZopeData>
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
-      <tuple>
-        <global name="ERP5Form" module="Products.ERP5Form.Form"/>
-        <tuple/>
-      </tuple>
+      <global name="ERP5Form" module="Products.ERP5Form.Form"/>
     </pickle>
     <pickle>
       <dictionary>
@@ -80,6 +77,7 @@
                         <string>ac_password</string>
                         <string>came_from</string>
                         <string>login</string>
+                        <string>reset_password</string>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form/ac_password.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form/ac_password.xml
index 7d2f8a5778..b81c4fe1dc 100644
--- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form/ac_password.xml
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form/ac_password.xml
@@ -2,10 +2,7 @@
 <ZopeData>
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
-      <tuple>
-        <global name="EditorField" module="Products.ERP5Form.EditorField"/>
-        <tuple/>
-      </tuple>
+      <global name="EditorField" module="Products.ERP5Form.EditorField"/>
     </pickle>
     <pickle>
       <dictionary>
@@ -214,7 +211,7 @@
                     <key> <string>default</string> </key>
                     <value> <string encoding="cdata"><![CDATA[
 
-<input name="__ac_password" id="password"   value="" type="password" size="30"\n
+<input name="__ac_password"id="__ac_password"  value="" type="password" size="30"\n
 onkeypress="submitFormOnEnter(event,\n
 \'main_form\',\n
 \'WebSite_login\',\n
diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form/reset_password.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form/reset_password.xml
new file mode 100644
index 0000000000..c86fb5ba92
--- /dev/null
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/login_form/reset_password.xml
@@ -0,0 +1,298 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="EditorField" module="Products.ERP5Form.EditorField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>reset_password</string> </value>
+        </item>
+        <item>
+            <key> <string>message_values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>external_validator_failed</string> </key>
+                    <value> <string>The input failed the external validator.</string> </value>
+                </item>
+                <item>
+                    <key> <string>line_too_long</string> </key>
+                    <value> <string>A line was too long.</string> </value>
+                </item>
+                <item>
+                    <key> <string>required_not_found</string> </key>
+                    <value> <string>Input is required but no input given.</string> </value>
+                </item>
+                <item>
+                    <key> <string>too_long</string> </key>
+                    <value> <string>You entered too many characters.</string> </value>
+                </item>
+                <item>
+                    <key> <string>too_many_lines</string> </key>
+                    <value> <string>You entered too many lines.</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>overrides</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>external_validator</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>height</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_length</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_linelength</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_lines</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>text_editor</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>width</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>tales</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>external_validator</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>height</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_length</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_linelength</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_lines</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>text_editor</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>width</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string>hidden_label</string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string encoding="cdata"><![CDATA[
+
+<input type="hidden" value="" name="reference"\n
+id="reference"/>\n
+<input type="button" name="ERP5Site_newCredentialRecovery:method" value="I forgot my password." onclick="requestPasswordReset(\'ERP5Site_newCredentialRecovery\');"/>
+
+]]></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>external_validator</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>height</string> </key>
+                    <value> <int>5</int> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>max_length</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_linelength</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_lines</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>text_editor</string> </key>
+                    <value> <string>text_area</string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string>reset_password</string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>width</string> </key>
+                    <value> <int>40</int> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_km/bt/revision b/bt5/erp5_km/bt/revision
index 9b21444cdb..dfd4d9fcda 100644
--- a/bt5/erp5_km/bt/revision
+++ b/bt5/erp5_km/bt/revision
@@ -1 +1 @@
-1703
\ No newline at end of file
+1704
\ No newline at end of file
-- 
2.30.9