Merge with d36c55018d81d9bd6c771488900167ad054eae3b

This commit is contained in:
Heng Sin Low 2012-08-03 14:34:11 +08:00
commit 54db8b6742
23 changed files with 4902 additions and 72 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
UPDATE GL_JournalLine SET Account_ID = (SELECT Account_ID FROM C_ValidCombination vc WHERE vc.C_ValidCombination_ID = GL_JournalLine.C_ValidCombination_ID);
;
UPDATE AD_System
SET LastMigrationScriptApplied='858_IDEMPIERE-344_GLJournalImprovement.sql'
WHERE LastMigrationScriptApplied<'858_IDEMPIERE-344_GLJournalImprovement.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,14 @@
-- Aug 1, 2012 4:43:04 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Select Role',200009,'D','15bdd556-85d4-4518-87e9-4ab298c49bb0','SelectRole','Y',TO_DATE('2012-08-01 16:43:01','YYYY-MM-DD HH24:MI:SS'),0,0,0,0,TO_DATE('2012-08-01 16:43:01','YYYY-MM-DD HH24:MI:SS'))
;
-- Aug 1, 2012 4:43:04 PM COT
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200009 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
UPDATE AD_System
SET LastMigrationScriptApplied='859_IDEMPIERE-354.sql'
WHERE LastMigrationScriptApplied<'859_IDEMPIERE-354.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,23 @@
-- Aug 2, 2012 10:34:37 PM COT
-- IDEMPIERE-344 Improve usability for GL Journal
UPDATE AD_Field SET IsAllowCopy='N',Updated=TO_DATE('2012-08-02 22:34:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200189
;
-- Aug 2, 2012 10:34:56 PM COT
UPDATE AD_Field SET IsAllowCopy='N',Updated=TO_DATE('2012-08-02 22:34:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200205
;
-- Aug 2, 2012 10:35:00 PM COT
UPDATE AD_Field SET IsAllowCopy='N',Updated=TO_DATE('2012-08-02 22:35:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200206
;
-- Aug 2, 2012 10:35:17 PM COT
UPDATE AD_Field SET IsAllowCopy='N',Updated=TO_DATE('2012-08-02 22:35:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200203
;
UPDATE AD_System
SET LastMigrationScriptApplied='861_IDEMPIERE-344_GLJournalImprovement.sql'
WHERE LastMigrationScriptApplied<'861_IDEMPIERE-344_GLJournalImprovement.sql'
OR LastMigrationScriptApplied IS NULL
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
UPDATE GL_JournalLine SET Account_ID = (SELECT Account_ID FROM C_ValidCombination vc WHERE vc.C_ValidCombination_ID = GL_JournalLine.C_ValidCombination_ID);
;
UPDATE AD_System
SET LastMigrationScriptApplied='858_IDEMPIERE-344_GLJournalImprovement.sql'
WHERE LastMigrationScriptApplied<'858_IDEMPIERE-344_GLJournalImprovement.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,14 @@
-- Aug 1, 2012 4:43:04 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Select Role',200009,'D','15bdd556-85d4-4518-87e9-4ab298c49bb0','SelectRole','Y',TO_TIMESTAMP('2012-08-01 16:43:01','YYYY-MM-DD HH24:MI:SS'),0,0,0,0,TO_TIMESTAMP('2012-08-01 16:43:01','YYYY-MM-DD HH24:MI:SS'))
;
-- Aug 1, 2012 4:43:04 PM COT
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200009 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
UPDATE AD_System
SET LastMigrationScriptApplied='859_IDEMPIERE-354.sql'
WHERE LastMigrationScriptApplied<'859_IDEMPIERE-354.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,23 @@
-- Aug 2, 2012 10:34:37 PM COT
-- IDEMPIERE-344 Improve usability for GL Journal
UPDATE AD_Field SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2012-08-02 22:34:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200189
;
-- Aug 2, 2012 10:34:56 PM COT
UPDATE AD_Field SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2012-08-02 22:34:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200205
;
-- Aug 2, 2012 10:35:00 PM COT
UPDATE AD_Field SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2012-08-02 22:35:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200206
;
-- Aug 2, 2012 10:35:17 PM COT
UPDATE AD_Field SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2012-08-02 22:35:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200203
;
UPDATE AD_System
SET LastMigrationScriptApplied='861_IDEMPIERE-344_GLJournalImprovement.sql'
WHERE LastMigrationScriptApplied<'861_IDEMPIERE-344_GLJournalImprovement.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -18,10 +18,11 @@ package org.compiere.process;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.model.MClient;
import org.compiere.model.MPasswordRule;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
import org.compiere.model.MUser; import org.compiere.model.MUser;
import org.compiere.util.Util; import org.compiere.util.Util;
/** /**
* Reset Password * Reset Password
* *
@ -33,7 +34,9 @@ public class UserPassword extends SvrProcess
private int p_AD_User_ID = -1; private int p_AD_User_ID = -1;
private String p_OldPassword = null; private String p_OldPassword = null;
private String p_NewPassword = null; private String p_NewPassword = null;
private String p_NewPasswordConfirm = null;
private String p_NewEMail = null; private String p_NewEMail = null;
private String p_NewEMailConfirm = null;
private String p_NewEMailUser = null; private String p_NewEMailUser = null;
private String p_NewEMailUserPW = null; private String p_NewEMailUserPW = null;
@ -60,6 +63,10 @@ public class UserPassword extends SvrProcess
p_NewEMailUser = (String)para[i].getParameter(); p_NewEMailUser = (String)para[i].getParameter();
else if (name.equals("NewEMailUserPW")) else if (name.equals("NewEMailUserPW"))
p_NewEMailUserPW = (String)para[i].getParameter(); p_NewEMailUserPW = (String)para[i].getParameter();
else if (name.equals("NewPasswordConfirm"))
p_NewPasswordConfirm=(String)para[i].getParameter();
else if (name.equals("NewEMailConfirm"))
p_NewEMailConfirm = (String)para[i].getParameter();
else else
log.log(Level.SEVERE, "Unknown Parameter: " + name); log.log(Level.SEVERE, "Unknown Parameter: " + name);
} }
@ -87,18 +94,43 @@ public class UserPassword extends SvrProcess
|| p_AD_User_ID == 100 // change of SuperUser || p_AD_User_ID == 100 // change of SuperUser
|| !operator.isAdministrator()) || !operator.isAdministrator())
throw new IllegalArgumentException("@OldPasswordMandatory@"); throw new IllegalArgumentException("@OldPasswordMandatory@");
} } else {
// is entered Password correct ? // is entered Password correct ?
else { if (hash_password) {
if (hash_password){ if (!user.authenticateHash(p_OldPassword))
if (!user.authenticateHash(p_OldPassword) )
throw new IllegalArgumentException("@OldPasswordNoMatch@"); throw new IllegalArgumentException("@OldPasswordNoMatch@");
} else{ } else {
if (!p_OldPassword.equals(user.getPassword())) if (!p_OldPassword.equals(user.getPassword()))
throw new IllegalArgumentException("@OldPasswordNoMatch@"); throw new IllegalArgumentException("@OldPasswordNoMatch@");
} }
} }
// new password confirm
if (!Util.isEmpty(p_NewPassword)) {
if (Util.isEmpty(p_NewPasswordConfirm)) {
throw new IllegalArgumentException("@NewPasswordConfirmMandatory@");
} else {
if (!p_NewPassword.equals(p_NewPasswordConfirm)) {
throw new IllegalArgumentException("@PasswordNotMatch@");
} else {
String msg = validate();
if (msg != null) {
throw new IllegalArgumentException(msg);
}
}
}
}
if (!Util.isEmpty(p_NewEMailUserPW)) {
if (Util.isEmpty(p_NewEMailConfirm)) {
throw new IllegalArgumentException("@NewEmailConfirmMandatory@");
} else {
if (!p_NewEMailUserPW.equals(p_NewEMailConfirm)) {
throw new IllegalArgumentException("@NewEmailNotMatch@");
}
}
}
if (!Util.isEmpty(p_NewPassword)) if (!Util.isEmpty(p_NewPassword))
user.setPassword(p_NewPassword); user.setPassword(p_NewPassword);
if (!Util.isEmpty(p_NewEMail)) if (!Util.isEmpty(p_NewEMail))
@ -112,4 +144,21 @@ public class UserPassword extends SvrProcess
return "OK"; return "OK";
} // doIt } // doIt
private String validate()
{
MClient client=new MClient(getCtx(), getAD_Client_ID(), get_TrxName());
int ad_passwordrule_id = client.getAD_PasswordRule_ID();
String error = null;
if (ad_passwordrule_id > 0)
{
MPasswordRule rule =new MPasswordRule(getCtx(), ad_passwordrule_id, get_TrxName());
error = rule.validate(p_NewPassword);
}
return error;
}
} // UserPassword } // UserPassword

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry exported="true" kind="lib" path="vt-crypt-2.1.4.jar"/>
<classpathentry exported="true" kind="lib" path="vt-dictionary-3.0.jar"/>
<classpathentry exported="true" kind="lib" path="vt-password-3.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="groovy-all-1.7.5.jar"/> <classpathentry exported="true" kind="lib" path="groovy-all-1.7.5.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<accessrules> <accessrules>

View File

@ -15,7 +15,10 @@ Bundle-ClassPath: base.jar,
jcommon-1.0.16.jar, jcommon-1.0.16.jar,
jfreechart-1.0.13.jar, jfreechart-1.0.13.jar,
jnlp.jar, jnlp.jar,
groovy-all-1.7.5.jar groovy-all-1.7.5.jar,
vt-crypt-2.1.4.jar,
vt-dictionary-3.0.jar,
vt-password-3.1.1.jar
Export-Package: bsh, Export-Package: bsh,
bsh.classpath, bsh.classpath,
bsh.collection, bsh.collection,

View File

@ -13,7 +13,10 @@ bin.includes = META-INF/,\
jfreechart-1.0.13.jar,\ jfreechart-1.0.13.jar,\
jnlp.jar,\ jnlp.jar,\
OSGI-INF/,\ OSGI-INF/,\
groovy-all-1.7.5.jar groovy-all-1.7.5.jar,\
vt-crypt-2.1.4.jar,\
vt-dictionary-3.0.jar,\
vt-password-3.1.1.jar
output.base.jar = build/ output.base.jar = build/
source.base.jar = src/ source.base.jar = src/
src.includes = schema/ src.includes = schema/

View File

@ -1581,6 +1581,13 @@ public abstract class Doc
*/ */
public int getGL_Category_ID() public int getGL_Category_ID()
{ {
int index = p_po.get_ColumnIndex("GL_Category_ID");
if (index != -1)
{
Integer ii = (Integer)p_po.get_Value(index);
if (ii != null)
return ii.intValue();
}
return m_GL_Category_ID; return m_GL_Category_ID;
} // getGL_Category_ID } // getGL_Category_ID

View File

@ -31,7 +31,7 @@ public interface I_AD_Client
public static final String Table_Name = "AD_Client"; public static final String Table_Name = "AD_Client";
/** AD_Table_ID=112 */ /** AD_Table_ID=112 */
public static final int Table_ID = MTable.getTable_ID(Table_Name); public static final int Table_ID = 112;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
@ -49,6 +49,15 @@ public interface I_AD_Client
*/ */
public int getAD_Client_ID(); public int getAD_Client_ID();
/** Column name AD_Client_UU */
public static final String COLUMNNAME_AD_Client_UU = "AD_Client_UU";
/** Set AD_Client_UU */
public void setAD_Client_UU (String AD_Client_UU);
/** Get AD_Client_UU */
public String getAD_Client_UU();
/** Column name AD_Language */ /** Column name AD_Language */
public static final String COLUMNNAME_AD_Language = "AD_Language"; public static final String COLUMNNAME_AD_Language = "AD_Language";
@ -75,6 +84,17 @@ public interface I_AD_Client
*/ */
public int getAD_Org_ID(); public int getAD_Org_ID();
/** Column name AD_PasswordRule_ID */
public static final String COLUMNNAME_AD_PasswordRule_ID = "AD_PasswordRule_ID";
/** Set AD_PasswordRule */
public void setAD_PasswordRule_ID (int AD_PasswordRule_ID);
/** Get AD_PasswordRule */
public int getAD_PasswordRule_ID();
public org.compiere.model.I_AD_PasswordRule getAD_PasswordRule() throws RuntimeException;
/** Column name AD_ReplicationStrategy_ID */ /** Column name AD_ReplicationStrategy_ID */
public static final String COLUMNNAME_AD_ReplicationStrategy_ID = "AD_ReplicationStrategy_ID"; public static final String COLUMNNAME_AD_ReplicationStrategy_ID = "AD_ReplicationStrategy_ID";
@ -88,7 +108,7 @@ public interface I_AD_Client
*/ */
public int getAD_ReplicationStrategy_ID(); public int getAD_ReplicationStrategy_ID();
public I_AD_ReplicationStrategy getAD_ReplicationStrategy() throws RuntimeException; public org.compiere.model.I_AD_ReplicationStrategy getAD_ReplicationStrategy() throws RuntimeException;
/** Column name AutoArchive */ /** Column name AutoArchive */
public static final String COLUMNNAME_AutoArchive = "AutoArchive"; public static final String COLUMNNAME_AutoArchive = "AutoArchive";
@ -171,19 +191,6 @@ public interface I_AD_Client
*/ */
public boolean isActive(); public boolean isActive();
/** Column name IsCostImmediate */
public static final String COLUMNNAME_IsCostImmediate = "IsCostImmediate";
/** Set Cost Immediately.
* Update Costs immediately for testing
*/
public void setIsCostImmediate (boolean IsCostImmediate);
/** Get Cost Immediately.
* Update Costs immediately for testing
*/
public boolean isCostImmediate();
/** Column name IsMultiLingualDocument */ /** Column name IsMultiLingualDocument */
public static final String COLUMNNAME_IsMultiLingualDocument = "IsMultiLingualDocument"; public static final String COLUMNNAME_IsMultiLingualDocument = "IsMultiLingualDocument";

View File

@ -0,0 +1,333 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_PasswordRule
* @author Adempiere (generated)
* @version Release 3.6.0LTS
*/
public interface I_AD_PasswordRule
{
/** TableName=AD_PasswordRule */
public static final String Table_Name = "AD_PasswordRule";
/** AD_Table_ID=200005 */
public static final int Table_ID = 200005;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 4 - System
*/
BigDecimal accessLevel = BigDecimal.valueOf(4);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AD_PasswordRule_ID */
public static final String COLUMNNAME_AD_PasswordRule_ID = "AD_PasswordRule_ID";
/** Set AD_PasswordRule */
public void setAD_PasswordRule_ID (int AD_PasswordRule_ID);
/** Get AD_PasswordRule */
public int getAD_PasswordRule_ID();
/** Column name AD_PasswordRule_UU */
public static final String COLUMNNAME_AD_PasswordRule_UU = "AD_PasswordRule_UU";
/** Set AD_PasswordRule_UU */
public void setAD_PasswordRule_UU (String AD_PasswordRule_UU);
/** Get AD_PasswordRule_UU */
public String getAD_PasswordRule_UU();
/** Column name AlphabeticalCharacter */
public static final String COLUMNNAME_AlphabeticalCharacter = "AlphabeticalCharacter";
/** Set Alphabetical Character */
public void setAlphabeticalCharacter (int AlphabeticalCharacter);
/** Get Alphabetical Character */
public int getAlphabeticalCharacter();
/** Column name AlphabeticalSequence */
public static final String COLUMNNAME_AlphabeticalSequence = "AlphabeticalSequence";
/** Set Alphabetical Sequence.
* Allow alphabetical sequences
*/
public void setAlphabeticalSequence (boolean AlphabeticalSequence);
/** Get Alphabetical Sequence.
* Allow alphabetical sequences
*/
public boolean isAlphabeticalSequence();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name DictMatchBackwards */
public static final String COLUMNNAME_DictMatchBackwards = "DictMatchBackwards";
/** Set Match Backwards of Dictionary.
* Match dictionary words backwards
*/
public void setDictMatchBackwards (boolean DictMatchBackwards);
/** Get Match Backwards of Dictionary.
* Match dictionary words backwards
*/
public boolean isDictMatchBackwards();
/** Column name DictWordLength */
public static final String COLUMNNAME_DictWordLength = "DictWordLength";
/** Set Word Length Dictionary */
public void setDictWordLength (int DictWordLength);
/** Get Word Length Dictionary */
public int getDictWordLength();
/** Column name DigitCharacter */
public static final String COLUMNNAME_DigitCharacter = "DigitCharacter";
/** Set Digit Character.
* Require at least # digit in passwords
*/
public void setDigitCharacter (int DigitCharacter);
/** Get Digit Character.
* Require at least # digit in passwords
*/
public int getDigitCharacter();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name LowercaseCharacter */
public static final String COLUMNNAME_LowercaseCharacter = "LowercaseCharacter";
/** Set Lowercase Character.
* Require at least # lower case char
*/
public void setLowercaseCharacter (int LowercaseCharacter);
/** Get Lowercase Character.
* Require at least # lower case char
*/
public int getLowercaseCharacter();
/** Column name MaxLength */
public static final String COLUMNNAME_MaxLength = "MaxLength";
/** Set Maximum Length.
* Maximum Length of Data
*/
public void setMaxLength (int MaxLength);
/** Get Maximum Length.
* Maximum Length of Data
*/
public int getMaxLength();
/** Column name MinLength */
public static final String COLUMNNAME_MinLength = "MinLength";
/** Set Min Length */
public void setMinLength (int MinLength);
/** Get Min Length */
public int getMinLength();
/** Column name Name */
public static final String COLUMNNAME_Name = "Name";
/** Set Name.
* Alphanumeric identifier of the entity
*/
public void setName (String Name);
/** Get Name.
* Alphanumeric identifier of the entity
*/
public String getName();
/** Column name NonAlphaNumericCharacter */
public static final String COLUMNNAME_NonAlphaNumericCharacter = "NonAlphaNumericCharacter";
/** Set Non Alpha Numeric Character.
* Require at least # non-alphanumeric char
*/
public void setNonAlphaNumericCharacter (int NonAlphaNumericCharacter);
/** Get Non Alpha Numeric Character.
* Require at least # non-alphanumeric char
*/
public int getNonAlphaNumericCharacter();
/** Column name NumericalSequence */
public static final String COLUMNNAME_NumericalSequence = "NumericalSequence";
/** Set Numerical Sequence.
* Allow numerical sequences of length #
*/
public void setNumericalSequence (int NumericalSequence);
/** Get Numerical Sequence.
* Allow numerical sequences of length #
*/
public int getNumericalSequence();
/** Column name PathDictionary */
public static final String COLUMNNAME_PathDictionary = "PathDictionary";
/** Set Path Dictionary */
public void setPathDictionary (String PathDictionary);
/** Get Path Dictionary */
public String getPathDictionary();
/** Column name QWERTYSequence */
public static final String COLUMNNAME_QWERTYSequence = "QWERTYSequence";
/** Set QWERTY Sequence.
* Allow QWERTY sequences
*/
public void setQWERTYSequence (boolean QWERTYSequence);
/** Get QWERTY Sequence.
* Allow QWERTY sequences
*/
public boolean isQWERTYSequence();
/** Column name RepeatCharacterRegex */
public static final String COLUMNNAME_RepeatCharacterRegex = "RepeatCharacterRegex";
/** Set Repeat Character Regex */
public void setRepeatCharacterRegex (int RepeatCharacterRegex);
/** Get Repeat Character Regex */
public int getRepeatCharacterRegex();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
/** Column name UppercaseCharacter */
public static final String COLUMNNAME_UppercaseCharacter = "UppercaseCharacter";
/** Set Uppercase Character.
* Require at least # upper case char
*/
public void setUppercaseCharacter (int UppercaseCharacter);
/** Get Uppercase Character.
* Require at least # upper case char
*/
public int getUppercaseCharacter();
/** Column name UserName */
public static final String COLUMNNAME_UserName = "UserName";
/** Set Registered EMail.
* Email of the responsible for the System
*/
public void setUserName (boolean UserName);
/** Get Registered EMail.
* Email of the responsible for the System
*/
public boolean isUserName();
/** Column name UsingDictionary */
public static final String COLUMNNAME_UsingDictionary = "UsingDictionary";
/** Set Using Dictionary */
public void setUsingDictionary (boolean UsingDictionary);
/** Get Using Dictionary */
public boolean isUsingDictionary();
/** Column name whitespace */
public static final String COLUMNNAME_whitespace = "whitespace";
/** Set whitespace */
public void setwhitespace (boolean whitespace);
/** Get whitespace */
public boolean iswhitespace();
}

View File

@ -136,7 +136,6 @@ public class MClient extends X_AD_Client
setAutoArchive(AUTOARCHIVE_None); setAutoArchive(AUTOARCHIVE_None);
setMMPolicy (MMPOLICY_FiFo); // F setMMPolicy (MMPOLICY_FiFo); // F
setIsPostImmediate(false); setIsPostImmediate(false);
setIsCostImmediate(false);
} }
else else
load(get_TrxName()); load(get_TrxName());

View File

@ -0,0 +1,186 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) Trek Global All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* *
* @author Juliana Corredor, jcorredor@trekglobal.com *
* IDEMPIERE-221 Password reset validation *
* http://jira.idempiere.com/browse/IDEMPIERE-221 *
* *
*****************************************************************************/
package org.compiere.model;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Properties;
import edu.vt.middleware.dictionary.ArrayWordList;
import edu.vt.middleware.dictionary.WordListDictionary;
import edu.vt.middleware.dictionary.WordLists;
import edu.vt.middleware.dictionary.sort.ArraysSort;
import edu.vt.middleware.password.AlphabeticalSequenceRule;
import edu.vt.middleware.password.CharacterCharacteristicsRule;
import edu.vt.middleware.password.DictionarySubstringRule;
import edu.vt.middleware.password.DigitCharacterRule;
import edu.vt.middleware.password.LengthRule;
import edu.vt.middleware.password.LowercaseCharacterRule;
import edu.vt.middleware.password.NonAlphanumericCharacterRule;
import edu.vt.middleware.password.NumericalSequenceRule;
import edu.vt.middleware.password.Password;
import edu.vt.middleware.password.PasswordData;
import edu.vt.middleware.password.PasswordValidator;
import edu.vt.middleware.password.QwertySequenceRule;
import edu.vt.middleware.password.RepeatCharacterRegexRule;
import edu.vt.middleware.password.Rule;
import edu.vt.middleware.password.RuleResult;
import edu.vt.middleware.password.UppercaseCharacterRule;
import edu.vt.middleware.password.WhitespaceRule;
/**
* @author juliana
*
*/
public class MPasswordRule extends X_AD_PasswordRule {
/**
*
*/
private static final long serialVersionUID = 6369065572886752718L;
/**
* @param ctx
* @param AD_PasswordRule_ID
* @param trxName
*/
public MPasswordRule(Properties ctx, int AD_PasswordRule_ID, String trxName) {
super(ctx, AD_PasswordRule_ID, trxName);
}
/**
* @param ctx
* @param rs
* @param trxName
*/
public MPasswordRule(Properties ctx, ResultSet rs, String trxName) {
super(ctx, rs, trxName);
}
public String validate(String newPassword) {
WhitespaceRule whitespaceRule;
AlphabeticalSequenceRule alphaSeqRule;
NumericalSequenceRule numSeqRule;
QwertySequenceRule qwertySeqRule;
RepeatCharacterRegexRule repeatRule;
ArrayList<Rule> ruleList = new ArrayList<Rule>();
if (getMinLength()>0 || getMaxLength()>0) {
LengthRule lengthRule = new LengthRule();
if (getMinLength()>0)
lengthRule.setMinimumLength(getMinLength());
if (getMaxLength()>0)
lengthRule.setMaximumLength(getMaxLength());
ruleList.add(lengthRule);
}
if (iswhitespace()) {
whitespaceRule = new WhitespaceRule();
ruleList.add(whitespaceRule);
}
// control allowed characters
CharacterCharacteristicsRule charRule = new CharacterCharacteristicsRule();
if (getDigitCharacter()>0) {
// require at least 1 digit in passwords
charRule.getRules().add(new DigitCharacterRule(getDigitCharacter()));
}
if (getNonAlphaNumericCharacter()>0) {
// require at least 1 non-alphanumeric char
charRule.getRules().add(new NonAlphanumericCharacterRule(getNonAlphaNumericCharacter()));
}
if (getUppercaseCharacter()>0) {
charRule.getRules().add(new UppercaseCharacterRule(getUppercaseCharacter()));
}
if (getLowercaseCharacter()>0) {
charRule.getRules().add(new LowercaseCharacterRule(getLowercaseCharacter()));
}
ruleList.add(charRule);
if (isAlphabeticalSequence()) {
alphaSeqRule=new AlphabeticalSequenceRule();
ruleList.add(alphaSeqRule);
}
if (getNumericalSequence()>0) {
numSeqRule = new NumericalSequenceRule(getNumericalSequence(),true);
ruleList.add(numSeqRule);
}
if (isQWERTYSequence()) {
qwertySeqRule = new QwertySequenceRule();
ruleList.add(qwertySeqRule);
}
if (getRepeatCharacterRegex()>0) {
repeatRule = new RepeatCharacterRegexRule(getRepeatCharacterRegex());
ruleList.add(repeatRule);
}
if (isUsingDictionary()) {
if (getPathDictionary().length()>0) {
try {
ArrayWordList awl = WordLists.createFromReader(
new FileReader[] {new FileReader(getPathDictionary())},
true,
new ArraysSort());
WordListDictionary dict = new WordListDictionary(awl);
DictionarySubstringRule dictRule = new DictionarySubstringRule(dict);
if (getDictWordLength()>0) {
dictRule.setWordLength(getDictWordLength()); // size of words to check in the password
}
else{
dictRule.setWordLength(DictionarySubstringRule.DEFAULT_WORD_LENGTH);
}
if (isDictMatchBackwards()) {
dictRule.setMatchBackwards(true); // match dictionary words backwards
}
ruleList.add(dictRule);
} catch (FileNotFoundException e) {
return "Could not find dictionary file: " + e.getMessage();
} catch (IOException e) {
return "Could not read dictionary file: " + e.getMessage();
}
}
}
if (!ruleList.isEmpty()) {
PasswordValidator validator = new PasswordValidator(ruleList);
PasswordData passwordData = new PasswordData(new Password(newPassword));
RuleResult result = validator.validate(passwordData);
if (!result.isValid()) {
String error = null;
for (String msg : validator.getMessages(result)) {
error = (error == null ? "" : error) + " " + msg;
}
return error;
}
}
return null;
}
}

View File

@ -480,7 +480,7 @@ public class MSystem extends X_AD_System
public static boolean isZKRememberPasswordAllowed() { public static boolean isZKRememberPasswordAllowed() {
String ca = MSysConfig.getValue("ZK_LOGIN_ALLOW_REMEMBER_ME", SYSTEM_ALLOW_REMEMBER_USER); String ca = MSysConfig.getValue("ZK_LOGIN_ALLOW_REMEMBER_ME", SYSTEM_ALLOW_REMEMBER_USER);
return (ca.equalsIgnoreCase(SYSTEM_ALLOW_REMEMBER_PASSWORD)); return (ca.equalsIgnoreCase(SYSTEM_ALLOW_REMEMBER_PASSWORD) && !MSysConfig.getBooleanValue("USER_PASSWORD_HASH", false));
} }
public static boolean isSwingRememberUserAllowed() { public static boolean isSwingRememberUserAllowed() {
@ -490,7 +490,7 @@ public class MSystem extends X_AD_System
public static boolean isSwingRememberPasswordAllowed() { public static boolean isSwingRememberPasswordAllowed() {
String ca = MSysConfig.getValue("SWING_LOGIN_ALLOW_REMEMBER_ME", SYSTEM_ALLOW_REMEMBER_PASSWORD); String ca = MSysConfig.getValue("SWING_LOGIN_ALLOW_REMEMBER_ME", SYSTEM_ALLOW_REMEMBER_PASSWORD);
return (ca.equalsIgnoreCase(SYSTEM_ALLOW_REMEMBER_PASSWORD)); return (ca.equalsIgnoreCase(SYSTEM_ALLOW_REMEMBER_PASSWORD) && !MSysConfig.getBooleanValue("USER_PASSWORD_HASH", false));
} }
/** /**

View File

@ -30,7 +30,7 @@ public class X_AD_Client extends PO implements I_AD_Client, I_Persistent
/** /**
* *
*/ */
private static final long serialVersionUID = 20100614L; private static final long serialVersionUID = 20120802L;
/** Standard Constructor */ /** Standard Constructor */
public X_AD_Client (Properties ctx, int AD_Client_ID, String trxName) public X_AD_Client (Properties ctx, int AD_Client_ID, String trxName)
@ -39,8 +39,6 @@ public class X_AD_Client extends PO implements I_AD_Client, I_Persistent
/** if (AD_Client_ID == 0) /** if (AD_Client_ID == 0)
{ {
setAutoArchive (null); setAutoArchive (null);
// N
setIsCostImmediate (false);
// N // N
setIsMultiLingualDocument (false); setIsMultiLingualDocument (false);
setIsPostImmediate (false); setIsPostImmediate (false);
@ -89,6 +87,20 @@ public class X_AD_Client extends PO implements I_AD_Client, I_Persistent
return sb.toString(); return sb.toString();
} }
/** Set AD_Client_UU.
@param AD_Client_UU AD_Client_UU */
public void setAD_Client_UU (String AD_Client_UU)
{
set_Value (COLUMNNAME_AD_Client_UU, AD_Client_UU);
}
/** Get AD_Client_UU.
@return AD_Client_UU */
public String getAD_Client_UU ()
{
return (String)get_Value(COLUMNNAME_AD_Client_UU);
}
/** AD_Language AD_Reference_ID=327 */ /** AD_Language AD_Reference_ID=327 */
public static final int AD_LANGUAGE_AD_Reference_ID=327; public static final int AD_LANGUAGE_AD_Reference_ID=327;
/** Set Language. /** Set Language.
@ -109,9 +121,34 @@ public class X_AD_Client extends PO implements I_AD_Client, I_Persistent
return (String)get_Value(COLUMNNAME_AD_Language); return (String)get_Value(COLUMNNAME_AD_Language);
} }
public I_AD_ReplicationStrategy getAD_ReplicationStrategy() throws RuntimeException public org.compiere.model.I_AD_PasswordRule getAD_PasswordRule() throws RuntimeException
{ {
return (I_AD_ReplicationStrategy)MTable.get(getCtx(), I_AD_ReplicationStrategy.Table_Name) return (org.compiere.model.I_AD_PasswordRule)MTable.get(getCtx(), org.compiere.model.I_AD_PasswordRule.Table_Name)
.getPO(getAD_PasswordRule_ID(), get_TrxName()); }
/** Set AD_PasswordRule.
@param AD_PasswordRule_ID AD_PasswordRule */
public void setAD_PasswordRule_ID (int AD_PasswordRule_ID)
{
if (AD_PasswordRule_ID < 1)
set_Value (COLUMNNAME_AD_PasswordRule_ID, null);
else
set_Value (COLUMNNAME_AD_PasswordRule_ID, Integer.valueOf(AD_PasswordRule_ID));
}
/** Get AD_PasswordRule.
@return AD_PasswordRule */
public int getAD_PasswordRule_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_PasswordRule_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_AD_ReplicationStrategy getAD_ReplicationStrategy() throws RuntimeException
{
return (org.compiere.model.I_AD_ReplicationStrategy)MTable.get(getCtx(), org.compiere.model.I_AD_ReplicationStrategy.Table_Name)
.getPO(getAD_ReplicationStrategy_ID(), get_TrxName()); } .getPO(getAD_ReplicationStrategy_ID(), get_TrxName()); }
/** Set Replication Strategy. /** Set Replication Strategy.
@ -216,30 +253,6 @@ public class X_AD_Client extends PO implements I_AD_Client, I_Persistent
return (String)get_Value(COLUMNNAME_EMailTest); return (String)get_Value(COLUMNNAME_EMailTest);
} }
/** Set Cost Immediately.
@param IsCostImmediate
Update Costs immediately for testing
*/
public void setIsCostImmediate (boolean IsCostImmediate)
{
set_Value (COLUMNNAME_IsCostImmediate, Boolean.valueOf(IsCostImmediate));
}
/** Get Cost Immediately.
@return Update Costs immediately for testing
*/
public boolean isCostImmediate ()
{
Object oo = get_Value(COLUMNNAME_IsCostImmediate);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Multi Lingual Documents. /** Set Multi Lingual Documents.
@param IsMultiLingualDocument @param IsMultiLingualDocument
Documents are Multi Lingual Documents are Multi Lingual

View File

@ -0,0 +1,471 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.KeyNamePair;
/** Generated Model for AD_PasswordRule
* @author Adempiere (generated)
* @version Release 3.6.0LTS - $Id$ */
public class X_AD_PasswordRule extends PO implements I_AD_PasswordRule, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20120802L;
/** Standard Constructor */
public X_AD_PasswordRule (Properties ctx, int AD_PasswordRule_ID, String trxName)
{
super (ctx, AD_PasswordRule_ID, trxName);
/** if (AD_PasswordRule_ID == 0)
{
setAD_PasswordRule_ID (0);
} */
}
/** Load Constructor */
public X_AD_PasswordRule (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 4 - System
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_AD_PasswordRule[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set AD_PasswordRule.
@param AD_PasswordRule_ID AD_PasswordRule */
public void setAD_PasswordRule_ID (int AD_PasswordRule_ID)
{
if (AD_PasswordRule_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_PasswordRule_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_PasswordRule_ID, Integer.valueOf(AD_PasswordRule_ID));
}
/** Get AD_PasswordRule.
@return AD_PasswordRule */
public int getAD_PasswordRule_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_PasswordRule_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set AD_PasswordRule_UU.
@param AD_PasswordRule_UU AD_PasswordRule_UU */
public void setAD_PasswordRule_UU (String AD_PasswordRule_UU)
{
set_Value (COLUMNNAME_AD_PasswordRule_UU, AD_PasswordRule_UU);
}
/** Get AD_PasswordRule_UU.
@return AD_PasswordRule_UU */
public String getAD_PasswordRule_UU ()
{
return (String)get_Value(COLUMNNAME_AD_PasswordRule_UU);
}
/** Set Alphabetical Character.
@param AlphabeticalCharacter Alphabetical Character */
public void setAlphabeticalCharacter (int AlphabeticalCharacter)
{
set_Value (COLUMNNAME_AlphabeticalCharacter, Integer.valueOf(AlphabeticalCharacter));
}
/** Get Alphabetical Character.
@return Alphabetical Character */
public int getAlphabeticalCharacter ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AlphabeticalCharacter);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Alphabetical Sequence.
@param AlphabeticalSequence
Allow alphabetical sequences
*/
public void setAlphabeticalSequence (boolean AlphabeticalSequence)
{
set_Value (COLUMNNAME_AlphabeticalSequence, Boolean.valueOf(AlphabeticalSequence));
}
/** Get Alphabetical Sequence.
@return Allow alphabetical sequences
*/
public boolean isAlphabeticalSequence ()
{
Object oo = get_Value(COLUMNNAME_AlphabeticalSequence);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Match Backwards of Dictionary.
@param DictMatchBackwards
Match dictionary words backwards
*/
public void setDictMatchBackwards (boolean DictMatchBackwards)
{
set_Value (COLUMNNAME_DictMatchBackwards, Boolean.valueOf(DictMatchBackwards));
}
/** Get Match Backwards of Dictionary.
@return Match dictionary words backwards
*/
public boolean isDictMatchBackwards ()
{
Object oo = get_Value(COLUMNNAME_DictMatchBackwards);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Word Length Dictionary.
@param DictWordLength Word Length Dictionary */
public void setDictWordLength (int DictWordLength)
{
set_Value (COLUMNNAME_DictWordLength, Integer.valueOf(DictWordLength));
}
/** Get Word Length Dictionary.
@return Word Length Dictionary */
public int getDictWordLength ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DictWordLength);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Digit Character.
@param DigitCharacter
Require at least # digit in passwords
*/
public void setDigitCharacter (int DigitCharacter)
{
set_Value (COLUMNNAME_DigitCharacter, Integer.valueOf(DigitCharacter));
}
/** Get Digit Character.
@return Require at least # digit in passwords
*/
public int getDigitCharacter ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DigitCharacter);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Lowercase Character.
@param LowercaseCharacter
Require at least # lower case char
*/
public void setLowercaseCharacter (int LowercaseCharacter)
{
set_Value (COLUMNNAME_LowercaseCharacter, Integer.valueOf(LowercaseCharacter));
}
/** Get Lowercase Character.
@return Require at least # lower case char
*/
public int getLowercaseCharacter ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_LowercaseCharacter);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Maximum Length.
@param MaxLength
Maximum Length of Data
*/
public void setMaxLength (int MaxLength)
{
set_Value (COLUMNNAME_MaxLength, Integer.valueOf(MaxLength));
}
/** Get Maximum Length.
@return Maximum Length of Data
*/
public int getMaxLength ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MaxLength);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Min Length.
@param MinLength Min Length */
public void setMinLength (int MinLength)
{
set_Value (COLUMNNAME_MinLength, Integer.valueOf(MinLength));
}
/** Get Min Length.
@return Min Length */
public int getMinLength ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MinLength);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Non Alpha Numeric Character.
@param NonAlphaNumericCharacter
Require at least # non-alphanumeric char
*/
public void setNonAlphaNumericCharacter (int NonAlphaNumericCharacter)
{
set_Value (COLUMNNAME_NonAlphaNumericCharacter, Integer.valueOf(NonAlphaNumericCharacter));
}
/** Get Non Alpha Numeric Character.
@return Require at least # non-alphanumeric char
*/
public int getNonAlphaNumericCharacter ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_NonAlphaNumericCharacter);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Numerical Sequence.
@param NumericalSequence
Allow numerical sequences of length #
*/
public void setNumericalSequence (int NumericalSequence)
{
set_Value (COLUMNNAME_NumericalSequence, Integer.valueOf(NumericalSequence));
}
/** Get Numerical Sequence.
@return Allow numerical sequences of length #
*/
public int getNumericalSequence ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_NumericalSequence);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Path Dictionary.
@param PathDictionary Path Dictionary */
public void setPathDictionary (String PathDictionary)
{
set_Value (COLUMNNAME_PathDictionary, PathDictionary);
}
/** Get Path Dictionary.
@return Path Dictionary */
public String getPathDictionary ()
{
return (String)get_Value(COLUMNNAME_PathDictionary);
}
/** Set QWERTY Sequence.
@param QWERTYSequence
Allow QWERTY sequences
*/
public void setQWERTYSequence (boolean QWERTYSequence)
{
set_Value (COLUMNNAME_QWERTYSequence, Boolean.valueOf(QWERTYSequence));
}
/** Get QWERTY Sequence.
@return Allow QWERTY sequences
*/
public boolean isQWERTYSequence ()
{
Object oo = get_Value(COLUMNNAME_QWERTYSequence);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Repeat Character Regex.
@param RepeatCharacterRegex Repeat Character Regex */
public void setRepeatCharacterRegex (int RepeatCharacterRegex)
{
set_Value (COLUMNNAME_RepeatCharacterRegex, Integer.valueOf(RepeatCharacterRegex));
}
/** Get Repeat Character Regex.
@return Repeat Character Regex */
public int getRepeatCharacterRegex ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_RepeatCharacterRegex);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Uppercase Character.
@param UppercaseCharacter
Require at least # upper case char
*/
public void setUppercaseCharacter (int UppercaseCharacter)
{
set_Value (COLUMNNAME_UppercaseCharacter, Integer.valueOf(UppercaseCharacter));
}
/** Get Uppercase Character.
@return Require at least # upper case char
*/
public int getUppercaseCharacter ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UppercaseCharacter);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Registered EMail.
@param UserName
Email of the responsible for the System
*/
public void setUserName (boolean UserName)
{
set_Value (COLUMNNAME_UserName, Boolean.valueOf(UserName));
}
/** Get Registered EMail.
@return Email of the responsible for the System
*/
public boolean isUserName ()
{
Object oo = get_Value(COLUMNNAME_UserName);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Using Dictionary.
@param UsingDictionary Using Dictionary */
public void setUsingDictionary (boolean UsingDictionary)
{
set_Value (COLUMNNAME_UsingDictionary, Boolean.valueOf(UsingDictionary));
}
/** Get Using Dictionary.
@return Using Dictionary */
public boolean isUsingDictionary ()
{
Object oo = get_Value(COLUMNNAME_UsingDictionary);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set whitespace.
@param whitespace whitespace */
public void setwhitespace (boolean whitespace)
{
set_Value (COLUMNNAME_whitespace, Boolean.valueOf(whitespace));
}
/** Get whitespace.
@return whitespace */
public boolean iswhitespace ()
{
Object oo = get_Value(COLUMNNAME_whitespace);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
}

View File

@ -68,7 +68,6 @@ import org.zkoss.zhtml.Td;
import org.zkoss.zhtml.Tr; import org.zkoss.zhtml.Tr;
import org.zkoss.zk.au.out.AuFocus; import org.zkoss.zk.au.out.AuFocus;
import org.zkoss.zk.au.out.AuScript; import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.fn.ZkFns;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Session; import org.zkoss.zk.ui.Session;
@ -109,6 +108,7 @@ public class LoginPanel extends Window implements EventListener
private Combobox lstLanguage; private Combobox lstLanguage;
private LoginWindow wndLogin; private LoginWindow wndLogin;
private Checkbox chkRememberMe; private Checkbox chkRememberMe;
private Checkbox chkSelectRole;
public LoginPanel(Properties ctx, LoginWindow loginWindow) public LoginPanel(Properties ctx, LoginWindow loginWindow)
{ {
@ -200,6 +200,17 @@ public class LoginPanel extends Window implements EventListener
td.setSclass(ITheme.LOGIN_FIELD_CLASS); td.setSclass(ITheme.LOGIN_FIELD_CLASS);
tr.appendChild(td); tr.appendChild(td);
td.appendChild(chkRememberMe); td.appendChild(chkRememberMe);
tr = new Tr();
tr.setId("rowSelectRole");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
td.setSclass(ITheme.LOGIN_LABEL_CLASS);
td.appendChild(new Label(""));
td = new Td();
td.setSclass(ITheme.LOGIN_FIELD_CLASS);
tr.appendChild(td);
td.appendChild(chkSelectRole);
} }
div = new Div(); div = new Div();
@ -240,6 +251,7 @@ public class LoginPanel extends Window implements EventListener
txtPassword.setAttribute("user.token.hash", token); txtPassword.setAttribute("user.token.hash", token);
txtPassword.setAttribute("user.token.sid", AD_Session_ID); txtPassword.setAttribute("user.token.sid", AD_Session_ID);
} }
chkSelectRole.setChecked(false);
} }
} }
} }
@ -305,6 +317,8 @@ public class LoginPanel extends Window implements EventListener
chkRememberMe = new Checkbox(Msg.getMsg(Language.getBaseAD_Language(), "RememberMe")); chkRememberMe = new Checkbox(Msg.getMsg(Language.getBaseAD_Language(), "RememberMe"));
chkSelectRole = new Checkbox(Msg.getMsg(Language.getBaseAD_Language(), "SelectRole"));
// Make the default language the language of client System // Make the default language the language of client System
String defaultLanguage = MClient.get(ctx, 0).getAD_Language(); String defaultLanguage = MClient.get(ctx, 0).getAD_Language();
for(int i = 0; i < lstLanguage.getItemCount(); i++) for(int i = 0; i < lstLanguage.getItemCount(); i++)
@ -393,6 +407,8 @@ public class LoginPanel extends Window implements EventListener
lblPassword.setValue(res.getString("Password")); lblPassword.setValue(res.getString("Password"));
lblLanguage.setValue(res.getString("Language")); lblLanguage.setValue(res.getString("Language"));
chkRememberMe.setLabel(Msg.getMsg(language, "RememberMe")); chkRememberMe.setLabel(Msg.getMsg(language, "RememberMe"));
chkSelectRole.setLabel(Msg.getMsg(language, "SelectRole"));
} }
private Language findLanguage(String langName) { private Language findLanguage(String langName) {
@ -431,6 +447,8 @@ public class LoginPanel extends Window implements EventListener
} }
} }
Env.setContext(ctx, BrowserToken.REMEMBER_ME, chkRememberMe.isChecked());
Session currSess = Executions.getCurrent().getDesktop().getSession(); Session currSess = Executions.getCurrent().getDesktop().getSession();
KeyNamePair rolesKNPairs[] = login.getRoles(userId, userPassword); KeyNamePair rolesKNPairs[] = login.getRoles(userId, userPassword);
@ -445,10 +463,10 @@ public class LoginPanel extends Window implements EventListener
else else
langName = Language.getBaseLanguage().getName(); langName = Language.getBaseLanguage().getName();
Language language = findLanguage(langName); Language language = findLanguage(langName);
wndLogin.loginOk(userId, userPassword);
Env.setContext(ctx, UserPreference.LANGUAGE_NAME, language.getName()); // Elaine 2009/02/06 Env.setContext(ctx, UserPreference.LANGUAGE_NAME, language.getName()); // Elaine 2009/02/06
wndLogin.loginOk(userId, userPassword, chkSelectRole.isChecked());
Locale locale = language.getLocale(); Locale locale = language.getLocale();
currSess.setAttribute(Attributes.PREFERRED_LOCALE, locale); currSess.setAttribute(Attributes.PREFERRED_LOCALE, locale);
try { try {
@ -470,8 +488,6 @@ public class LoginPanel extends Window implements EventListener
currSess.setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx)); currSess.setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx));
// End of temporary code for [ adempiere-ZK Web Client-2832968 ] User context lost? // End of temporary code for [ adempiere-ZK Web Client-2832968 ] User context lost?
Env.setContext(ctx, BrowserToken.REMEMBER_ME, chkRememberMe.isChecked());
/* Check DB version */ /* Check DB version */
String version = DB.getSQLValueString(null, "SELECT Version FROM AD_System"); String version = DB.getSQLValueString(null, "SELECT Version FROM AD_System");
// Identical DB version // Identical DB version

View File

@ -97,11 +97,14 @@ public class RolePanel extends Window implements EventListener, Deferrable
/** Password */ /** Password */
private String m_password; private String m_password;
public RolePanel(Properties ctx, LoginWindow loginWindow, String userName, String password) { private boolean m_show = true;
public RolePanel(Properties ctx, LoginWindow loginWindow, String userName, String password, boolean show) {
this.wndLogin = loginWindow; this.wndLogin = loginWindow;
m_ctx = ctx; m_ctx = ctx;
m_userName = userName; m_userName = userName;
m_password = password; login = new Login(ctx); m_password = password; login = new Login(ctx);
m_show = show;
rolesKNPairs = login.getRoles(userName, password); rolesKNPairs = login.getRoles(userName, password);
if(rolesKNPairs == null) if(rolesKNPairs == null)
throw new ApplicationException("Login is invalid, UserName: " + userName + " and Password:" + password); throw new ApplicationException("Login is invalid, UserName: " + userName + " and Password:" + password);
@ -110,8 +113,12 @@ public class RolePanel extends Window implements EventListener, Deferrable
init(); init();
this.setId("rolePanel"); this.setId("rolePanel");
if (m_show) {
AuFocus auf = new AuFocus(lstRole); AuFocus auf = new AuFocus(lstRole);
Clients.response(auf); Clients.response(auf);
} else {
validateRoles();
}
} }
private void init() private void init()
@ -298,8 +305,10 @@ public class RolePanel extends Window implements EventListener, Deferrable
if(rolesKNPairs[i].getID().equals(initDefault)) if(rolesKNPairs[i].getID().equals(initDefault))
lstRole.setSelectedItem(ci); lstRole.setSelectedItem(ci);
} }
if (lstRole.getSelectedIndex() == -1 && lstRole.getItemCount() > 0) if (lstRole.getSelectedIndex() == -1 && lstRole.getItemCount() > 0) {
m_show = true; // didn't find default role
lstRole.setSelectedIndex(0); lstRole.setSelectedIndex(0);
}
// //
// If we have only one role, we can hide the combobox - metas-2009_0021_AP1_G94 // If we have only one role, we can hide the combobox - metas-2009_0021_AP1_G94
@ -338,9 +347,11 @@ public class RolePanel extends Window implements EventListener, Deferrable
if(clientKNPairs[i].getID().equals(initDefault)) if(clientKNPairs[i].getID().equals(initDefault))
lstClient.setSelectedItem(ci); lstClient.setSelectedItem(ci);
} }
if (lstClient.getSelectedIndex() == -1 && lstClient.getItemCount() > 0) if (lstClient.getSelectedIndex() == -1 && lstClient.getItemCount() > 0) {
m_show = true; // didn't find default client
lstClient.setSelectedIndex(0); lstClient.setSelectedIndex(0);
} }
}
// //
//force reload of default role //force reload of default role
@ -372,9 +383,11 @@ public class RolePanel extends Window implements EventListener, Deferrable
lstOrganisation.setSelectedItem(ci); lstOrganisation.setSelectedItem(ci);
} }
if (lstOrganisation.getSelectedIndex() == -1 && lstOrganisation.getItemCount() > 0) if (lstOrganisation.getSelectedIndex() == -1 && lstOrganisation.getItemCount() > 0) {
m_show = true; // didn't find default organisation
lstOrganisation.setSelectedIndex(0); lstOrganisation.setSelectedIndex(0);
} }
}
// //
} }
updateWarehouseList(); updateWarehouseList();
@ -401,9 +414,11 @@ public class RolePanel extends Window implements EventListener, Deferrable
if(warehouseKNPairs[i].getID().equals(initDefault)) if(warehouseKNPairs[i].getID().equals(initDefault))
lstWarehouse.setSelectedItem(ci); lstWarehouse.setSelectedItem(ci);
} }
if (lstWarehouse.getSelectedIndex() == -1 && lstWarehouse.getItemCount() > 0) if (lstWarehouse.getSelectedIndex() == -1 && lstWarehouse.getItemCount() > 0) {
m_show = true; // didn't find default warehouse
lstWarehouse.setSelectedIndex(0); lstWarehouse.setSelectedIndex(0);
} }
}
// //
} }
} }

View File

@ -74,9 +74,9 @@ public class LoginWindow extends FWindow implements EventListener
pnlLogin = new LoginPanel(ctx, this); pnlLogin = new LoginPanel(ctx, this);
} }
public void loginOk(String userName, String password) public void loginOk(String userName, String password, boolean show)
{ {
pnlRole = new RolePanel(ctx, this, userName, password); pnlRole = new RolePanel(ctx, this, userName, password, show);
this.getChildren().clear(); this.getChildren().clear();
this.appendChild(pnlRole); this.appendChild(pnlRole);
} }