svn commit: r703647 - in /ofbiz/trunk: applications/securityext/src/org/ofbiz/securityext/login/ framework/common/webcommon/ framework/common/webcommon/WEB-INF/ framework/common/widget/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r703647 - in /ofbiz/trunk: applications/securityext/src/org/ofbiz/securityext/login/ framework/common/webcommon/ framework/common/webcommon/WEB-INF/ framework/common/widget/

jleroux@apache.org
Author: jleroux
Date: Sat Oct 11 04:01:01 2008
New Revision: 703647

URL: http://svn.apache.org/viewvc?rev=703647&view=rev
Log:
A patch from Bruno Busco "Adding forgot password feature in framework" (https://issues.apache.org/jira/browse/OFBIZ-1894) - OFBIZ-1894

Added:
    ofbiz/trunk/framework/common/webcommon/forgotPassword.ftl   (with props)
Modified:
    ofbiz/trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java
    ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
    ofbiz/trunk/framework/common/webcommon/login.ftl
    ofbiz/trunk/framework/common/widget/CommonScreens.xml

Modified: ofbiz/trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java?rev=703647&r1=703646&r2=703647&view=diff
==============================================================================
--- ofbiz/trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java (original)
+++ ofbiz/trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java Sat Oct 11 04:01:01 2008
@@ -95,7 +95,8 @@
     }
 
     /**
-     * The user forgot his/her password.  This will either call showPasswordHint or emailPassword.
+     * The user forgot his/her password.  This will call showPasswordHint, emailPassword or simply returns "success" in case
+     * no operation has been specified.
      *
      * @param request The HTTPRequest object for the current request
      * @param response The HTTPResponse object for the current request
@@ -104,9 +105,11 @@
     public static String forgotPassword(HttpServletRequest request, HttpServletResponse response) {
         if ((UtilValidate.isNotEmpty(request.getParameter("GET_PASSWORD_HINT"))) || (UtilValidate.isNotEmpty(request.getParameter("GET_PASSWORD_HINT.x")))) {
             return showPasswordHint(request, response);
-        } else {
+        } else if ((UtilValidate.isNotEmpty(request.getParameter("EMAIL_PASSWORD"))) || (UtilValidate.isNotEmpty(request.getParameter("EMAIL_PASSWORD.x")))) {
             return emailPassword(request, response);
-        }
+        } else {
+            return "success";
+        }    
     }
 
     /** Show the password hint for the userLoginId specified in the request object.

Modified: ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml?rev=703647&r1=703646&r2=703647&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml (original)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml Sat Oct 11 04:01:01 2008
@@ -78,6 +78,12 @@
         <response name="success" type="request" value="checkLogin"/>
         <response name="error" type="view" value="main"/>
     </request-map>
+    <request-map uri="forgotPassword">
+        <security https="true" auth="false" />
+        <event type="java" path="org.ofbiz.securityext.login.LoginEvents" invoke="forgotPassword"/>
+        <response name="success" type="view" value="forgotPassword" />
+        <response name="error" type="view" value="forgotPassword" />
+    </request-map>
 
     <!-- Common Mappings used for locales and timezones -->
     <request-map uri="setSessionLocale">
@@ -130,6 +136,7 @@
     <view-map name="error" page="/error/error.jsp"/>
     <view-map name="login" type="screen" page="component://common/widget/CommonScreens.xml#login"/>
     <view-map name="requirePasswordChange" type="screen" page="component://common/widget/CommonScreens.xml#requirePasswordChange"/>
+    <view-map name="forgotPassword" type="screen" page="component://common/widget/CommonScreens.xml#forgotPassword"/>
     <view-map name="EventMessages" type="screen" page="component://common/widget/CommonScreens.xml#EventMessages"/>
 
     <view-map name="LookupLocales" type="screen" page="component://common/widget/LookupScreens.xml#LookupLocales"/>

Added: ofbiz/trunk/framework/common/webcommon/forgotPassword.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/forgotPassword.ftl?rev=703647&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/forgotPassword.ftl (added)
+++ ofbiz/trunk/framework/common/webcommon/forgotPassword.ftl Sat Oct 11 04:01:01 2008
@@ -0,0 +1,42 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<center>
+  <div class="screenlet login-screenlet">
+    <div class="screenlet-title-bar">
+      <h3>${uiLabelMap.CommonForgotYourPassword}?</h3>
+    </div>
+    <div class="screenlet-body">
+      <form method="post" action="<@ofbizUrl>forgotPassword${previousParams?if_exists}</@ofbizUrl>" name="forgotpassword">
+        <table class="basic-table" cellspacing="0">
+          <tr>
+            <td class="label">${uiLabelMap.CommonUsername}</td>
+            <td><input type="text" size="20" name="USERNAME" value="<#if requestParameters.USERNAME?has_content>${requestParameters.USERNAME}<#elseif autoUserLogin?has_content>${autoUserLogin.userLoginId}</#if>"/></td>
+          </tr>
+          <tr>
+            <td colspan="2" align="center">
+              <input type="submit" name="GET_PASSWORD_HINT" class="smallSubmit" value="${uiLabelMap.CommonGetPasswordHint}"/>&nbsp;<input type="submit" name="EMAIL_PASSWORD" class="smallSubmit" value="${uiLabelMap.CommonEmailPassword}"/>
+            </td>
+          </tr>
+        </table>
+        <input type="hidden" name="JavaScriptEnabled" value="N"/>
+      </form>
+    </div>
+  </div>
+</center>

Propchange: ofbiz/trunk/framework/common/webcommon/forgotPassword.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/common/webcommon/forgotPassword.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/common/webcommon/forgotPassword.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/framework/common/webcommon/login.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/login.ftl?rev=703647&r1=703646&r2=703647&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/login.ftl (original)
+++ ofbiz/trunk/framework/common/webcommon/login.ftl Sat Oct 11 04:01:01 2008
@@ -53,6 +53,8 @@
           </tr>
         </table>
         <input type="hidden" name="JavaScriptEnabled" value="N"/>
+        <br/>
+        <a href="<@ofbizUrl>forgotPassword</@ofbizUrl>">${uiLabelMap.CommonForgotYourPassword}?</a>
       </form>
     </div>
   </div>

Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=703647&r1=703646&r2=703647&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Sat Oct 11 04:01:01 2008
@@ -350,6 +350,20 @@
         </section>
     </screen>
 
+    <screen name="forgotPassword">
+        <section>
+            <widgets>
+                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <platform-specific>
+                            <html><html-template location="component://common/webcommon/forgotPassword.ftl"/></html>
+                        </platform-specific>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
     <screen name="EventMessages">
         <section>
             <actions>