Author: jleroux
Date: Sat Dec 15 04:59:22 2007 New Revision: 604424 URL: http://svn.apache.org/viewvc?rev=604424&view=rev Log: Applied fix from trunk for revision: 604423 Added: ofbiz/branches/release4.0/framework/guiapp/config/ - copied from r604423, ofbiz/trunk/framework/guiapp/config/ ofbiz/branches/release4.0/framework/guiapp/config/XuiUiLabels.properties - copied unchanged from r604423, ofbiz/trunk/framework/guiapp/config/XuiUiLabels.properties ofbiz/branches/release4.0/framework/guiapp/config/XuiUiLabels_fr.properties - copied unchanged from r604423, ofbiz/trunk/framework/guiapp/config/XuiUiLabels_fr.properties ofbiz/branches/release4.0/framework/guiapp/config/xui.properties - copied unchanged from r604423, ofbiz/trunk/framework/guiapp/config/xui.properties Modified: ofbiz/branches/release4.0/framework/guiapp/ofbiz-component.xml ofbiz/branches/release4.0/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiSession.java Modified: ofbiz/branches/release4.0/framework/guiapp/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/framework/guiapp/ofbiz-component.xml?rev=604424&r1=604423&r2=604424&view=diff ============================================================================== --- ofbiz/branches/release4.0/framework/guiapp/ofbiz-component.xml (original) +++ ofbiz/branches/release4.0/framework/guiapp/ofbiz-component.xml Sat Dec 15 04:59:22 2007 @@ -22,6 +22,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/ofbiz-component.xsd"> <resource-loader name="main" type="component"/> + <classpath type="dir" location="config"/> <classpath type="jar" location="lib/*"/> <classpath type="jar" location="build/lib/*"/> </ofbiz-component> Modified: ofbiz/branches/release4.0/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiSession.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiSession.java?rev=604424&r1=604423&r2=604424&view=diff ============================================================================== --- ofbiz/branches/release4.0/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiSession.java (original) +++ ofbiz/branches/release4.0/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiSession.java Sat Dec 15 04:59:22 2007 @@ -19,11 +19,13 @@ package org.ofbiz.guiapp.xui; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.webapp.control.LoginWorker; import org.ofbiz.entity.GenericDelegator; @@ -43,7 +45,8 @@ protected XuiContainer container = null; protected Map attributes = new HashMap(); protected String id = null; - + protected final boolean IS_SAME_LOGIN = UtilProperties.propertyValueEqualsIgnoreCase("xui.properties", "isSameLogin", "true"); + private Locale locale = (Locale) Locale.getDefault(); public XuiSession(String id, GenericDelegator delegator, LocalDispatcher dispatcher, XuiContainer container) { this.id = id; @@ -105,10 +108,10 @@ } public void login(String username, String password) throws UserLoginFailure { - // if already logged in; verify for lock - if (this.userLogin != null) { - if (!userLogin.getString("userLoginId").equals(username)) { - throw new UserLoginFailure("Username does not match already logged in user!"); + // if already logged in; verify for lock. Depends on SAME_LOGIN, false by default + if (this.userLogin != null) { + if (IS_SAME_LOGIN == true && !userLogin.getString("userLoginId").equals(username)) { + throw new UserLoginFailure(UtilProperties.getMessage("XuiUiLabels", "UsernameDoesNotMatchLoggedUser", locale)); } } this.userLogin = this.checkLogin(username, password); @@ -117,13 +120,13 @@ public GenericValue checkLogin(String username, String password) throws UserLoginFailure { // check the required parameters and objects if (dispatcher == null) { - throw new UserLoginFailure("Unable to log in; XUI not configured propertly"); + throw new UserLoginFailure(UtilProperties.getMessage("XuiUiLabels", "UnableToLogIn", locale)); } if (UtilValidate.isEmpty(username)) { - throw new UserLoginFailure("Username is missing"); + throw new UserLoginFailure(UtilProperties.getMessage("PartyUiLabels", "PartyUserNameMissing", locale)); } if (UtilValidate.isEmpty(password)) { - throw new UserLoginFailure("Password is missing"); + throw new UserLoginFailure(UtilProperties.getMessage("PartyUiLabels", "PartyPasswordMissing", locale)); } // call the login service @@ -134,7 +137,7 @@ Debug.logError(e, module); throw new UserLoginFailure(e); } catch (Throwable t) { - Debug.logError(t, "Thowable caught!", module); + Debug.logError(t, "Throwable caught!", module); } // check for errors @@ -143,7 +146,7 @@ } else { GenericValue ul = (GenericValue) result.get("userLogin"); if (ul == null) { - throw new UserLoginFailure("UserLogin return was not valid (null)"); + throw new UserLoginFailure(UtilProperties.getMessage("XuiUiLabels", "UserLoginNotValid", locale)); } return ul; } |
Free forum by Nabble | Edit this page |