IDEMPIERE-2558:don't allow use old password when change password

update library to passay
This commit is contained in:
hieplq 2015-04-06 10:27:21 +07:00
parent d959dbff8f
commit bd51dfdf4e
7 changed files with 62 additions and 46 deletions

View File

@ -0,0 +1,10 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
-- Apr 6, 2015 1:54:49 AM ICT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2015-04-06 01:54:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200080
;
SELECT register_migration_script('201504061604-IDEMPIERE-2558.sql') FROM dual
;

View File

@ -0,0 +1,7 @@
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
-- Apr 6, 2015 1:54:49 AM ICT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2015-04-06 01:54:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200080
;
SELECT register_migration_script('201504061604-IDEMPIERE-2558.sql') FROM dual
;

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="passay-1.0.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="bsh-2.0b5.jar"/>
@ -14,8 +15,6 @@
<classpathentry exported="true" kind="lib" path="jfreechart-1.0.19.jar"/>
<classpathentry exported="true" kind="lib" path="jnlp.jar"/>
<classpathentry exported="true" kind="lib" path="groovy-all-1.7.5.jar"/>
<classpathentry exported="true" kind="lib" path="vt-dictionary-3.0.jar"/>
<classpathentry exported="true" kind="lib" path="vt-password-3.1.2.jar"/>
<classpathentry exported="true" kind="lib" path="super-csv-2.2.0.jar"/>
<classpathentry exported="true" kind="lib" path="barcode4j-2.1.jar"/>
<classpathentry exported="true" kind="lib" path="bcprov-jdk15on-1.46.jar"/>

View File

@ -16,11 +16,10 @@ Bundle-ClassPath: base.jar,
jfreechart-1.0.19.jar,
jnlp.jar,
groovy-all-1.7.5.jar,
vt-dictionary-3.0.jar,
vt-password-3.1.2.jar,
super-csv-2.2.0.jar,
barcode4j-2.1.jar,
bcprov-jdk15on-1.46.jar
bcprov-jdk15on-1.46.jar,
passay-1.0.jar
Export-Package: bsh,
bsh.classpath,
bsh.collection,

View File

@ -14,8 +14,6 @@ bin.includes = META-INF/,\
jnlp.jar,\
OSGI-INF/,\
groovy-all-1.7.5.jar,\
vt-dictionary-3.0.jar,\
vt-password-3.1.2.jar,\
super-csv-2.2.0.jar,\
OSGI-INF/dslocator.xml,\
OSGI-INF/serverbean.xml,\
@ -35,7 +33,8 @@ bin.includes = META-INF/,\
OSGI-INF/addressvalidationeventhandler.xml,\
schema/,\
barcode4j-2.1.jar,\
bcprov-jdk15on-1.46.jar
bcprov-jdk15on-1.46.jar,\
passay-1.0.jar
output.base.jar = bin/
src.includes = schema/
source.base.jar = src/

View File

@ -30,32 +30,32 @@ import org.adempiere.exceptions.AdempiereException;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
import org.passay.AlphabeticalCharacterRule;
import org.passay.AlphabeticalSequenceRule;
import org.passay.CharacterCharacteristicsRule;
import org.passay.DictionarySubstringRule;
import org.passay.DigitCharacterRule;
import org.passay.LengthRule;
import org.passay.LowercaseCharacterRule;
import org.passay.MessageResolver;
import org.passay.NumericalSequenceRule;
import org.passay.PasswordData;
import org.passay.PasswordGenerator;
import org.passay.PasswordValidator;
import org.passay.PropertiesMessageResolver;
import org.passay.QwertySequenceRule;
import org.passay.RepeatCharacterRegexRule;
import org.passay.Rule;
import org.passay.RuleResult;
import org.passay.SpecialCharacterRule;
import org.passay.UppercaseCharacterRule;
import org.passay.UsernameRule;
import org.passay.WhitespaceRule;
import org.passay.dictionary.ArrayWordList;
import org.passay.dictionary.WordListDictionary;
import org.passay.dictionary.WordLists;
import org.passay.dictionary.sort.ArraysSort;
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.AlphabeticalCharacterRule;
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.MessageResolver;
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.PasswordGenerator;
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.UsernameRule;
import edu.vt.middleware.password.WhitespaceRule;
/**
* @author juliana
@ -144,7 +144,7 @@ public class MPasswordRule extends X_AD_PasswordRule {
if (getNonAlphaNumericCharacter() > 0) {
// require at least n non-alphanumeric char
numValidations++;
charRule.getRules().add(new NonAlphanumericCharacterRule(getNonAlphaNumericCharacter()));
charRule.getRules().add(new SpecialCharacterRule(getNonAlphaNumericCharacter()));
}
if (getUppercaseCharacter() > 0) {
numValidations++;
@ -193,11 +193,11 @@ public class MPasswordRule extends X_AD_PasswordRule {
WordListDictionary dict = new WordListDictionary(awl);
DictionarySubstringRule dictRule = new DictionarySubstringRule(dict);
if (getDictWordLength() > 0) {
/*if (getDictWordLength() > 0) {//when update library to passay. this method is miss
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
@ -215,7 +215,7 @@ public class MPasswordRule extends X_AD_PasswordRule {
if (!ruleList.isEmpty()) {
PasswordValidator validator = new PasswordValidator(getCustomResolver(), ruleList);
PasswordData passwordData = new PasswordData(new Password(newPassword));
PasswordData passwordData = new PasswordData(newPassword);
passwordData.setUsername(username);
RuleResult result = validator.validate(passwordData);
if (!result.isValid()) {
@ -253,9 +253,9 @@ public class MPasswordRule extends X_AD_PasswordRule {
}
}
if (props == null)
return new MessageResolver();
return new PropertiesMessageResolver();
else
return new MessageResolver(props);
return new PropertiesMessageResolver(props);
}
public String generate() {
@ -269,7 +269,7 @@ public class MPasswordRule extends X_AD_PasswordRule {
if (getNonAlphaNumericCharacter() > 0) {
// require at least n non-alphanumeric char
numValidations++;
charRule.getRules().add(new NonAlphanumericCharacterRule(getNonAlphaNumericCharacter()));
charRule.getRules().add(new SpecialCharacterRule(getNonAlphaNumericCharacter()));
}
if (getUppercaseCharacter() > 0) {
numValidations++;

View File

@ -27,12 +27,12 @@ import org.compiere.util.KeyNamePair;
public class X_AD_PasswordRule extends PO implements I_AD_PasswordRule, I_Persistent
{
/**
*
/**
*
*/
private static final long serialVersionUID = 20141030L;
private static final long serialVersionUID = -6204385406753580912L;
/** Standard Constructor */
/** Standard Constructor */
public X_AD_PasswordRule (Properties ctx, int AD_PasswordRule_ID, String trxName)
{
super (ctx, AD_PasswordRule_ID, trxName);
@ -154,14 +154,16 @@ public class X_AD_PasswordRule extends PO implements I_AD_PasswordRule, I_Persis
}
/** Set Word Length Dictionary.
@param DictWordLength Word Length Dictionary */
@param DictWordLength Word Length Dictionary
@deprecated by update library */
public void setDictWordLength (int DictWordLength)
{
set_Value (COLUMNNAME_DictWordLength, Integer.valueOf(DictWordLength));
}
/** Get Word Length Dictionary.
@return Word Length Dictionary */
@return Word Length Dictionary
@deprecated by update library*/
public int getDictWordLength ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DictWordLength);