v2.9.0 & PasswordPolicyValidator

This commit is contained in:
MaxKey
2021-08-09 17:13:19 +08:00
parent 7485cfb236
commit a769cc58f3
8 changed files with 95 additions and 56 deletions

View File

@@ -101,8 +101,12 @@ public class RealmAuthenticationProvider extends AbstractAuthenticationProvider
if(loginCredential.getAuthType().equalsIgnoreCase(AuthType.MOBILE)) {
mobilecaptchaValid(loginCredential.getPassword(),loginCredential.getAuthType(),userInfo);
}else {
authenticationRealm.getPasswordPolicyValidator().passwordPolicyValid(userInfo);
//Validate PasswordPolicy
authenticationRealm.getPasswordPolicyValidator().passwordPolicyValid(userInfo);
//Match password
authenticationRealm.passwordMatches(userInfo, loginCredential.getPassword());
//apply PasswordSetType and resetBadPasswordCount
authenticationRealm.getPasswordPolicyValidator().applyPasswordPolicy(userInfo);
}
UsernamePasswordAuthenticationToken authenticationToken = setOnline(loginCredential,userInfo);

View File

@@ -74,7 +74,7 @@ public class DefaultJdbcAuthenticationRealm extends AbstractAuthenticationRealm
_logger.debug("passwordvalid : " + passwordMatches);
if (!passwordMatches) {
passwordPolicyValidator.setBadPasswordCount(userInfo);
passwordPolicyValidator.plusBadPasswordCount(userInfo);
insertLoginHistory(userInfo, ConstantsLoginType.LOCAL, "", "xe00000004", "password error");
throw new BadCredentialsException(WebContext.getI18nValue("login.error.password"));
}