IDEMPIERE-221 Implement password policies / make password policy system wide configurable instead of tenant
This commit is contained in:
parent
4c951dd67d
commit
9735670208
|
@ -0,0 +1,8 @@
|
||||||
|
-- Sep 5, 2012 5:06:57 PM COT
|
||||||
|
-- IDEMPIERE-221 Implement password policies
|
||||||
|
UPDATE AD_Field SET DisplayLogic='@AD_Client_ID@=0',Updated=TO_DATE('2012-09-05 17:06:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200096
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('904_IDEMPIERE-221.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
-- Sep 5, 2012 5:06:57 PM COT
|
||||||
|
-- IDEMPIERE-221 Implement password policies
|
||||||
|
UPDATE AD_Field SET DisplayLogic='@AD_Client_ID@=0',Updated=TO_TIMESTAMP('2012-09-05 17:06:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200096
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('904_IDEMPIERE-221.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class MPasswordRule extends X_AD_PasswordRule {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -3557291675139843726L;
|
private static final long serialVersionUID = -4262842010340413022L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ctx
|
* @param ctx
|
||||||
|
@ -82,6 +82,16 @@ public class MPasswordRule extends X_AD_PasswordRule {
|
||||||
public MPasswordRule(Properties ctx, ResultSet rs, String trxName) {
|
public MPasswordRule(Properties ctx, ResultSet rs, String trxName) {
|
||||||
super(ctx, rs, trxName);
|
super(ctx, rs, trxName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MPasswordRule getRules(Properties ctx, String trxName) {
|
||||||
|
MClient system = MClient.get(ctx, 0);
|
||||||
|
int pwdruleID = system.getAD_PasswordRule_ID();
|
||||||
|
MPasswordRule pass = null;
|
||||||
|
if (pwdruleID > 0)
|
||||||
|
pass = new MPasswordRule(ctx, pwdruleID, trxName);
|
||||||
|
|
||||||
|
return pass;
|
||||||
|
}
|
||||||
|
|
||||||
public void validate(String username, String newPassword) throws AdempiereException {
|
public void validate(String username, String newPassword) throws AdempiereException {
|
||||||
|
|
||||||
|
|
|
@ -927,11 +927,9 @@ public class MUser extends X_AD_User
|
||||||
if (get_ValueOld("Salt") == null && get_Value("Salt") != null) { // being hashed
|
if (get_ValueOld("Salt") == null && get_Value("Salt") != null) { // being hashed
|
||||||
;
|
;
|
||||||
} else {
|
} else {
|
||||||
int pwdruleid = MClient.get(getCtx(), getAD_Client_ID()).getAD_PasswordRule_ID();
|
MPasswordRule pwdrule = MPasswordRule.getRules(getCtx(), get_TrxName());
|
||||||
if (pwdruleid > 0) {
|
if (pwdrule != null)
|
||||||
MPasswordRule pwdrule = new MPasswordRule(getCtx(), MClient.get(getCtx()).getAD_PasswordRule_ID(), get_TrxName());
|
|
||||||
pwdrule.validate((getLDAPUser() != null ? getLDAPUser() : getName()), getPassword());
|
pwdrule.validate((getLDAPUser() != null ? getLDAPUser() : getName()), getPassword());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash password - IDEMPIERE-347
|
// Hash password - IDEMPIERE-347
|
||||||
|
|
Loading…
Reference in New Issue