You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2009/02/08 09:14:58 UTC

svn commit: r742015 - in /ofbiz/trunk/framework: common/src/org/ofbiz/common/login/LoginServices.java common/webcommon/changePassword.ftl webapp/src/org/ofbiz/webapp/control/LoginWorker.java

Author: jacopoc
Date: Sun Feb  8 08:14:58 2009
New Revision: 742015

URL: http://svn.apache.org/viewvc?rev=742015&view=rev
Log:
Misc enhancements to the update password screen and events: improved layout, error handling.

Modified:
    ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java
    ofbiz/trunk/framework/common/webcommon/changePassword.ftl
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java

Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java?rev=742015&r1=742014&r2=742015&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java Sun Feb  8 08:14:58 2009
@@ -529,6 +529,7 @@
 
         // <b>security check</b>: userLogin userLoginId must equal userLoginId, or must have PARTYMGR_UPDATE permission
         // NOTE: must check permission first so that admin users can set own password without specifying old password
+        // TODO: change this security group because we can't use permission groups defined in the applications from the framework.
         if (!security.hasEntityPermission("PARTYMGR", "_UPDATE", loggedInUserLogin)) {
             if (!userLoginId.equals(loggedInUserLogin.getString("userLoginId"))) {
                 errMsg = UtilProperties.getMessage(resource,"loginservices.not_have_permission_update_password_for_user_login", locale);

Modified: ofbiz/trunk/framework/common/webcommon/changePassword.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/changePassword.ftl?rev=742015&r1=742014&r2=742015&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/changePassword.ftl (original)
+++ ofbiz/trunk/framework/common/webcommon/changePassword.ftl Sun Feb  8 08:14:58 2009
@@ -19,6 +19,7 @@
 
 <#assign username = requestParameters.USERNAME?default((sessionAttributes.autoUserLogin.userLoginId)?default(""))>
 
+<center>
 <div class="screenlet login-screenlet">
   <div class="screenlet-title-bar">
     <h3>${uiLabelMap.CommonPasswordChange}</h3>
@@ -53,6 +54,7 @@
     </form>
   </div>
 </div>
+</center>
 
 <script language="JavaScript" type="text/javascript">
   document.loginform.PASSWORD.focus();

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=742015&r1=742014&r2=742015&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Sun Feb  8 08:14:58 2009
@@ -352,9 +352,13 @@
                 return "error";
             }
             if (ServiceUtil.isError(result)) {
-                Map<String, String> messageMap = UtilMisc.toMap("errorMessage", (String) result.get(ModelService.ERROR_MESSAGE));
-                String errMsg = UtilProperties.getMessage(resourceWebapp, "loginevents.following_error_occurred_during_login", messageMap, UtilHttp.getLocale(request));
-                request.setAttribute("_ERROR_MESSAGE_", errMsg);
+                String errorMessage = (String) result.get(ModelService.ERROR_MESSAGE);
+                if (UtilValidate.isNotEmpty(errorMessage)) {
+                    Map<String, String> messageMap = UtilMisc.toMap("errorMessage", errorMessage);
+                    String errMsg = UtilProperties.getMessage(resourceWebapp, "loginevents.following_error_occurred_during_login", messageMap, UtilHttp.getLocale(request));
+                    request.setAttribute("_ERROR_MESSAGE_", errMsg);
+                }
+                request.setAttribute("_ERROR_MESSAGE_LIST_", (List) result.get(ModelService.ERROR_MESSAGE_LIST));
                 return "error";
             } else {
                 password = request.getParameter("newPassword");