mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-15 21:02:09 +08:00
PasswordPolicy fix
This commit is contained in:
@@ -82,12 +82,12 @@ public abstract class AbstractAuthenticationProvider {
|
||||
try {
|
||||
authentication = doInternalAuthenticate(authentication);
|
||||
} catch (AuthenticationException e) {
|
||||
e.printStackTrace();
|
||||
_logger.error("Failed to authenticate user {} via {}: {}",
|
||||
new Object[] {
|
||||
authentication.getPrincipal(), getProviderName(), e.getMessage() });
|
||||
WebContext.setAttribute(
|
||||
WebConstants.LOGIN_ERROR_SESSION_MESSAGE, e.getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String message = "Unexpected exception in " + getProviderName() + " authentication:";
|
||||
_logger.error("Login error " + message, e);
|
||||
}
|
||||
|
||||
@@ -217,12 +217,10 @@ public class PasswordPolicyValidator {
|
||||
_logger.debug("PasswordPolicy : " + passwordPolicy);
|
||||
_logger.debug("login Attempts is " + userInfo.getBadPasswordCount());
|
||||
lockUser(userInfo);
|
||||
|
||||
throw new BadCredentialsException(
|
||||
userInfo.getUsername() + " " +
|
||||
WebContext.getI18nValue("login.error.attempts") + " " +
|
||||
userInfo.getBadPasswordCount()
|
||||
);
|
||||
WebContext.getI18nValue("login.error.attempts",
|
||||
new Object[]{userInfo.getUsername(),userInfo.getBadPasswordCount()})
|
||||
);
|
||||
}
|
||||
|
||||
//locked
|
||||
@@ -235,8 +233,7 @@ public class PasswordPolicyValidator {
|
||||
// inactive
|
||||
if(userInfo.getStatus()!=ConstantsStatus.ACTIVE) {
|
||||
throw new BadCredentialsException(
|
||||
userInfo.getUsername()+ " status "+
|
||||
userInfo.getStatus() +
|
||||
userInfo.getUsername()+
|
||||
WebContext.getI18nValue("login.error.inactive")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -72,5 +72,7 @@ public class WebConstants {
|
||||
public static final String AUTHENTICATION = "current_authentication";
|
||||
|
||||
public static final String THEME_COOKIE_NAME = "maxkey_theme";
|
||||
|
||||
public static final String LOGIN_ERROR_SESSION_MESSAGE = "login_error_session_message_key";
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user