IDEMPIERE-221 Implement password policies / Thanks to Juliana Corredor
This commit is contained in:
parent
d9d27e6990
commit
0347e6f4e8
|
@ -29,6 +29,7 @@ import java.util.Properties;
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
import org.compiere.util.Util;
|
||||||
|
|
||||||
import edu.vt.middleware.dictionary.ArrayWordList;
|
import edu.vt.middleware.dictionary.ArrayWordList;
|
||||||
import edu.vt.middleware.dictionary.WordListDictionary;
|
import edu.vt.middleware.dictionary.WordListDictionary;
|
||||||
|
@ -64,7 +65,7 @@ public class MPasswordRule extends X_AD_PasswordRule {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 7376091524332484101L;
|
private static final long serialVersionUID = 5454698615095632059L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ctx
|
* @param ctx
|
||||||
|
@ -93,6 +94,27 @@ public class MPasswordRule extends X_AD_PasswordRule {
|
||||||
|
|
||||||
return pass;
|
return pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean beforeSave (boolean newRecord)
|
||||||
|
{
|
||||||
|
if (isUsingDictionary()) {
|
||||||
|
StringBuilder msg = new StringBuilder();
|
||||||
|
if (Util.isEmpty(getPathDictionary())) {
|
||||||
|
msg.append(Msg.getElement(getCtx(), COLUMNNAME_PathDictionary));
|
||||||
|
}
|
||||||
|
if (getDictWordLength() <= 0) {
|
||||||
|
if (msg.length() > 0)
|
||||||
|
msg.append(", ");
|
||||||
|
msg.append(Msg.getElement(getCtx(), COLUMNNAME_DictWordLength));
|
||||||
|
}
|
||||||
|
if (msg.length() > 0) {
|
||||||
|
log.saveError("FillMandatory", msg.toString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void validate(String username, String newPassword) throws AdempiereException {
|
public void validate(String username, String newPassword) throws AdempiereException {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue