mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-14 20:50:14 +08:00
v 3.3.0
This commit is contained in:
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
import javax.servlet.Filter;
|
||||
|
||||
import org.maxkey.configuration.ApplicationConfig;
|
||||
import org.maxkey.constants.ConstantsTimeInterval;
|
||||
import org.maxkey.constants.ConstsTimeInterval;
|
||||
import org.maxkey.persistence.repository.InstitutionsRepository;
|
||||
import org.maxkey.persistence.repository.LoginHistoryRepository;
|
||||
import org.maxkey.persistence.repository.LoginRepository;
|
||||
@@ -187,7 +187,7 @@ public class MvcAutoConfiguration implements InitializingBean , WebMvcConfigurer
|
||||
CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
|
||||
cookieLocaleResolver.setCookieName("mxk_locale");
|
||||
cookieLocaleResolver.setCookieDomain(domainName);
|
||||
cookieLocaleResolver.setCookieMaxAge(ConstantsTimeInterval.TWO_WEEK);
|
||||
cookieLocaleResolver.setCookieMaxAge(ConstsTimeInterval.TWO_WEEK);
|
||||
return cookieLocaleResolver;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,17 @@ public class EmailConfig {
|
||||
public EmailConfig() {
|
||||
}
|
||||
|
||||
/*
|
||||
public EmailConfig(String username, String password, String smtpHost, Integer port, boolean ssl, String sender) {
|
||||
super();
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.smtpHost = smtpHost;
|
||||
this.port = port;
|
||||
this.ssl = ssl;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
/*
|
||||
* @return the username
|
||||
*/
|
||||
public String getUsername() {
|
||||
|
||||
@@ -23,7 +23,7 @@ package org.maxkey.constants;
|
||||
* @author Crystal.Sea
|
||||
*
|
||||
*/
|
||||
public class Boolean {
|
||||
public class ConstsBoolean {
|
||||
|
||||
public static final int FALSE = 0;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Boolean {
|
||||
|
||||
private int value = FALSE;
|
||||
|
||||
public Boolean() {
|
||||
public ConstsBoolean() {
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.maxkey.constants;
|
||||
|
||||
import org.maxkey.configuration.ApplicationConfig;
|
||||
|
||||
public class ConstantsDatabase {
|
||||
public class ConstsDatabase {
|
||||
|
||||
public static String MYSQL = "MySQL";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package org.maxkey.constants;
|
||||
|
||||
public class ConstantsEntryType {
|
||||
public class ConstsEntryType {
|
||||
|
||||
public static int USERINFO_TYPE = 1;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package org.maxkey.constants;
|
||||
|
||||
public class ConstantsLoginType {
|
||||
public class ConstsLoginType {
|
||||
|
||||
public static final String LOCAL = "Local Login";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package org.maxkey.constants;
|
||||
|
||||
public final class ConstantsOperateAction {
|
||||
public final class ConstsOperateAction {
|
||||
|
||||
public static final int CREATE_ACTION = 1;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package org.maxkey.constants;
|
||||
|
||||
public final class ConstantsOperateMessage {
|
||||
public final class ConstsOperateMessage {
|
||||
|
||||
public static final String INSERT_SUCCESS = "message.action.insert.success";
|
||||
public static final String INSERT_ERROR = "message.action.insert.error";
|
||||
@@ -22,7 +22,7 @@ package org.maxkey.constants;
|
||||
* @author Crystal.Sea
|
||||
*
|
||||
*/
|
||||
public final class ConstantsPasswordSetType {
|
||||
public final class ConstsPasswordSetType {
|
||||
|
||||
public static final int PASSWORD_NORMAL = 0;
|
||||
|
||||
@@ -22,7 +22,7 @@ package org.maxkey.constants;
|
||||
* @author Crystal.Sea
|
||||
*
|
||||
*/
|
||||
public final class ConstantsPersistence {
|
||||
public final class ConstsPersistence {
|
||||
|
||||
public static final int INMEMORY = 0;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package org.maxkey.constants;
|
||||
|
||||
public final class ConstantsPlatformRole {
|
||||
public final class ConstsPlatformRole {
|
||||
|
||||
public static final String PLATFORM_ADMIN = "PLATFORM_ADMIN";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package org.maxkey.constants;
|
||||
|
||||
public class ConstantsProperties {
|
||||
public class ConstsProperties {
|
||||
|
||||
public static String classPathResource(String propertySource) {
|
||||
return propertySource.replaceAll("classpath:","");
|
||||
@@ -22,7 +22,7 @@ package org.maxkey.constants;
|
||||
* @author Crystal.Sea
|
||||
*
|
||||
*/
|
||||
public final class ConstantsProtocols {
|
||||
public final class ConstsProtocols {
|
||||
|
||||
public static final String BASIC = "Basic";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package org.maxkey.constants;
|
||||
|
||||
public final class ConstantsServiceMessage {
|
||||
public final class ConstsServiceMessage {
|
||||
|
||||
public static final class EMPLOYEES {
|
||||
public static final String SERVICE_NAME = "employees";
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package org.maxkey.constants;
|
||||
|
||||
public final class ConstantsStatus {
|
||||
public final class ConstsStatus {
|
||||
|
||||
public static final int ACTIVE = 1;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package org.maxkey.constants;
|
||||
|
||||
public final class ConstantsTimeInterval {
|
||||
public final class ConstsTimeInterval {
|
||||
|
||||
public static final Integer ONE_MINUTE = 60; // 1 minutes
|
||||
|
||||
@@ -25,7 +25,7 @@ import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseEntity;
|
||||
import org.maxkey.constants.ConstantsServiceMessage;
|
||||
import org.maxkey.constants.ConstsServiceMessage;
|
||||
import org.maxkey.exception.PasswordPolicyException;
|
||||
|
||||
/**
|
||||
@@ -342,16 +342,16 @@ public class PasswordPolicy extends JpaBaseEntity implements java.io.Serializabl
|
||||
|
||||
public void check(String username, String newPassword, String oldPassword) throws PasswordPolicyException {
|
||||
if ((1 == this.getUsername()) && newPassword.toLowerCase().contains(username.toLowerCase())) {
|
||||
throw new PasswordPolicyException(ConstantsServiceMessage.PASSWORDPOLICY.XW00000001);
|
||||
throw new PasswordPolicyException(ConstsServiceMessage.PASSWORDPOLICY.XW00000001);
|
||||
}
|
||||
if (oldPassword != null && newPassword.equalsIgnoreCase(oldPassword)) {
|
||||
throw new PasswordPolicyException(ConstantsServiceMessage.PASSWORDPOLICY.XW00000002);
|
||||
throw new PasswordPolicyException(ConstsServiceMessage.PASSWORDPOLICY.XW00000002);
|
||||
}
|
||||
if (newPassword.length() < this.getMinLength()) {
|
||||
throw new PasswordPolicyException(ConstantsServiceMessage.PASSWORDPOLICY.XW00000003, this.getMinLength());
|
||||
throw new PasswordPolicyException(ConstsServiceMessage.PASSWORDPOLICY.XW00000003, this.getMinLength());
|
||||
}
|
||||
if (newPassword.length() > this.getMaxLength()) {
|
||||
throw new PasswordPolicyException(ConstantsServiceMessage.PASSWORDPOLICY.XW00000004, this.getMaxLength());
|
||||
throw new PasswordPolicyException(ConstsServiceMessage.PASSWORDPOLICY.XW00000004, this.getMaxLength());
|
||||
}
|
||||
int numCount = 0, upperCount = 0, lowerCount = 0, spacil = 0;
|
||||
char[] chPwd = newPassword.toCharArray();
|
||||
@@ -372,16 +372,16 @@ public class PasswordPolicy extends JpaBaseEntity implements java.io.Serializabl
|
||||
spacil++;
|
||||
}
|
||||
if (numCount < this.getDigits()) {
|
||||
throw new PasswordPolicyException(ConstantsServiceMessage.PASSWORDPOLICY.XW00000005, this.getDigits());
|
||||
throw new PasswordPolicyException(ConstsServiceMessage.PASSWORDPOLICY.XW00000005, this.getDigits());
|
||||
}
|
||||
if (lowerCount < this.getLowerCase()) {
|
||||
throw new PasswordPolicyException(ConstantsServiceMessage.PASSWORDPOLICY.XW00000006, this.getLowerCase());
|
||||
throw new PasswordPolicyException(ConstsServiceMessage.PASSWORDPOLICY.XW00000006, this.getLowerCase());
|
||||
}
|
||||
if (upperCount < this.getUpperCase()) {
|
||||
throw new PasswordPolicyException(ConstantsServiceMessage.PASSWORDPOLICY.XW00000007, this.getUpperCase());
|
||||
throw new PasswordPolicyException(ConstsServiceMessage.PASSWORDPOLICY.XW00000007, this.getUpperCase());
|
||||
}
|
||||
if (spacil < this.getSpecialChar()) {
|
||||
throw new PasswordPolicyException(ConstantsServiceMessage.PASSWORDPOLICY.XW00000008, this.getSpecialChar());
|
||||
throw new PasswordPolicyException(ConstsServiceMessage.PASSWORDPOLICY.XW00000008, this.getSpecialChar());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseEntity;
|
||||
import org.maxkey.constants.ConstantsStatus;
|
||||
import org.maxkey.constants.ConstsStatus;
|
||||
import org.maxkey.web.WebContext;
|
||||
|
||||
@Entity
|
||||
@@ -44,7 +44,7 @@ public class RolePermissions extends JpaBaseEntity implements Serializable {
|
||||
@Column
|
||||
String resourceId;
|
||||
|
||||
int status = ConstantsStatus.ACTIVE;
|
||||
int status = ConstsStatus.ACTIVE;
|
||||
@Column
|
||||
private String instId;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseEntity;
|
||||
import org.maxkey.constants.Boolean;
|
||||
import org.maxkey.constants.ConstsBoolean;
|
||||
import org.maxkey.entity.Accounts;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -168,7 +168,7 @@ public class Apps extends JpaBaseEntity implements Serializable {
|
||||
|
||||
public Apps() {
|
||||
super();
|
||||
isSignature = Boolean.FALSE;
|
||||
isSignature = ConstsBoolean.FALSE;
|
||||
credential = CREDENTIALS.NONE;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.maxkey.constants.ConstantsStatus;
|
||||
import org.maxkey.constants.ConstantsTimeInterval;
|
||||
import org.maxkey.constants.ConstsStatus;
|
||||
import org.maxkey.entity.Institutions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -38,15 +37,15 @@ public class InstitutionsRepository {
|
||||
private static Logger _logger = LoggerFactory.getLogger(InstitutionsRepository.class);
|
||||
|
||||
private static final String SELECT_STATEMENT =
|
||||
"select * from mxk_institutions where domain = ? and status = " + ConstantsStatus.ACTIVE;
|
||||
"select * from mxk_institutions where domain = ? and status = " + ConstsStatus.ACTIVE;
|
||||
|
||||
private static final String SELECT_STATEMENT_BY_ID =
|
||||
"select * from mxk_institutions where id = ? and status = " + ConstantsStatus.ACTIVE;
|
||||
"select * from mxk_institutions where id = ? and status = " + ConstsStatus.ACTIVE;
|
||||
|
||||
protected static final Cache<String, Institutions> institutionsStore =
|
||||
Caffeine.newBuilder()
|
||||
.expireAfterWrite(ConstantsTimeInterval.ONE_HOUR, TimeUnit.SECONDS)
|
||||
.build();
|
||||
.expireAfterWrite(60, TimeUnit.MINUTES)
|
||||
.build();
|
||||
|
||||
//id domain mapping
|
||||
protected static final ConcurrentHashMap<String,String> mapper = new ConcurrentHashMap<String,String>();
|
||||
@@ -66,10 +65,12 @@ public class InstitutionsRepository {
|
||||
|
||||
if (institutions != null && institutions.size() > 0) {
|
||||
inst = institutions.get(0);
|
||||
institutionsStore.put(domain, inst);
|
||||
mapper.put(inst.getId(), domain);
|
||||
}else {
|
||||
//default institution
|
||||
inst = get("1");
|
||||
}
|
||||
|
||||
institutionsStore.put(domain, inst);
|
||||
mapper.put(inst.getId(), domain);
|
||||
}
|
||||
|
||||
return inst;
|
||||
@@ -77,7 +78,7 @@ public class InstitutionsRepository {
|
||||
|
||||
public Institutions get(String instId) {
|
||||
_logger.trace(" instId {}" , instId);
|
||||
Institutions inst = institutionsStore.getIfPresent(mapper.get(instId));
|
||||
Institutions inst = institutionsStore.getIfPresent(mapper.get(instId)==null ? "1" : mapper.get(instId) );
|
||||
if(inst == null) {
|
||||
List<Institutions> institutions =
|
||||
jdbcTemplate.query(SELECT_STATEMENT_BY_ID,new InstitutionsRowMapper(),instId);
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.maxkey.constants.ConstantsTimeInterval;
|
||||
import org.maxkey.constants.ConstsTimeInterval;
|
||||
import org.maxkey.entity.Localization;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -48,7 +48,7 @@ public class LocalizationRepository {
|
||||
|
||||
protected static final Cache<String, String> localizationStore =
|
||||
Caffeine.newBuilder()
|
||||
.expireAfterWrite(ConstantsTimeInterval.ONE_HOUR, TimeUnit.SECONDS)
|
||||
.expireAfterWrite(ConstsTimeInterval.ONE_HOUR, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
public LocalizationRepository() {
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.maxkey.constants.ConstantsStatus;
|
||||
import org.maxkey.constants.ConstsStatus;
|
||||
import org.maxkey.entity.Groups;
|
||||
import org.maxkey.entity.UserInfo;
|
||||
import org.maxkey.util.StringUtils;
|
||||
@@ -129,9 +129,9 @@ public class LoginRepository {
|
||||
try {
|
||||
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getId())) {
|
||||
jdbcTemplate.update(LOCK_USER_UPDATE_STATEMENT,
|
||||
new Object[] { ConstantsStatus.LOCK, new Date(), userInfo.getId() },
|
||||
new Object[] { ConstsStatus.LOCK, new Date(), userInfo.getId() },
|
||||
new int[] { Types.VARCHAR, Types.TIMESTAMP, Types.VARCHAR });
|
||||
userInfo.setIsLocked(ConstantsStatus.LOCK);
|
||||
userInfo.setIsLocked(ConstsStatus.LOCK);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
_logger.error("lockUser Exception",e);
|
||||
@@ -147,9 +147,9 @@ public class LoginRepository {
|
||||
try {
|
||||
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getId())) {
|
||||
jdbcTemplate.update(UNLOCK_USER_UPDATE_STATEMENT,
|
||||
new Object[] { ConstantsStatus.ACTIVE, new Date(), userInfo.getId() },
|
||||
new Object[] { ConstsStatus.ACTIVE, new Date(), userInfo.getId() },
|
||||
new int[] { Types.VARCHAR, Types.TIMESTAMP, Types.VARCHAR });
|
||||
userInfo.setIsLocked(ConstantsStatus.ACTIVE);
|
||||
userInfo.setIsLocked(ConstsStatus.ACTIVE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
_logger.error("unlockUser Exception",e);
|
||||
@@ -165,9 +165,9 @@ public class LoginRepository {
|
||||
try {
|
||||
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getId())) {
|
||||
jdbcTemplate.update(BADPASSWORDCOUNT_RESET_UPDATE_STATEMENT,
|
||||
new Object[] { 0, ConstantsStatus.ACTIVE, new Date(), userInfo.getId() },
|
||||
new Object[] { 0, ConstsStatus.ACTIVE, new Date(), userInfo.getId() },
|
||||
new int[] { Types.INTEGER, Types.INTEGER, Types.TIMESTAMP, Types.VARCHAR });
|
||||
userInfo.setIsLocked(ConstantsStatus.ACTIVE);
|
||||
userInfo.setIsLocked(ConstsStatus.ACTIVE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
_logger.error("resetBadPasswordCountAndLockout Exception",e);
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.maxkey.constants.ConstsProperties;
|
||||
import org.maxkey.entity.PasswordPolicy;
|
||||
import org.passay.CharacterOccurrencesRule;
|
||||
import org.passay.CharacterRule;
|
||||
@@ -139,7 +139,7 @@ public class PasswordPolicyRepository {
|
||||
try {
|
||||
ClassPathResource dictFile=
|
||||
new ClassPathResource(
|
||||
ConstantsProperties.classPathResource(topWeakPasswordPropertySource));
|
||||
ConstsProperties.classPathResource(topWeakPasswordPropertySource));
|
||||
Dictionary dictionary =new DictionaryBuilder().addReader(new InputStreamReader(dictFile.getInputStream())).build();
|
||||
passwordPolicyRuleList.add(new DictionaryRule(dictionary));
|
||||
}catch(Exception e) {
|
||||
|
||||
@@ -22,8 +22,8 @@ import java.util.Date;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.maxkey.constants.ConstantsPasswordSetType;
|
||||
import org.maxkey.constants.ConstantsStatus;
|
||||
import org.maxkey.constants.ConstsPasswordSetType;
|
||||
import org.maxkey.constants.ConstsStatus;
|
||||
import org.maxkey.crypto.password.PasswordGen;
|
||||
import org.maxkey.entity.PasswordPolicy;
|
||||
import org.maxkey.entity.UserInfo;
|
||||
@@ -149,14 +149,14 @@ public class PasswordPolicyValidator {
|
||||
}
|
||||
|
||||
//locked
|
||||
if(userInfo.getIsLocked()==ConstantsStatus.LOCK) {
|
||||
if(userInfo.getIsLocked()==ConstsStatus.LOCK) {
|
||||
throw new BadCredentialsException(
|
||||
userInfo.getUsername()+ " "+
|
||||
WebContext.getI18nValue("login.error.locked")
|
||||
);
|
||||
}
|
||||
// inactive
|
||||
if(userInfo.getStatus()!=ConstantsStatus.ACTIVE) {
|
||||
if(userInfo.getStatus()!=ConstsStatus.ACTIVE) {
|
||||
throw new BadCredentialsException(
|
||||
userInfo.getUsername()+
|
||||
WebContext.getI18nValue("login.error.inactive")
|
||||
@@ -173,16 +173,16 @@ public class PasswordPolicyValidator {
|
||||
//initial password need change
|
||||
if(userInfo.getLoginCount()<=0) {
|
||||
WebContext.getSession().setAttribute(WebConstants.CURRENT_USER_PASSWORD_SET_TYPE,
|
||||
ConstantsPasswordSetType.INITIAL_PASSWORD);
|
||||
ConstsPasswordSetType.INITIAL_PASSWORD);
|
||||
}
|
||||
|
||||
if (userInfo.getPasswordSetType() != ConstantsPasswordSetType.PASSWORD_NORMAL) {
|
||||
if (userInfo.getPasswordSetType() != ConstsPasswordSetType.PASSWORD_NORMAL) {
|
||||
WebContext.getSession().setAttribute(WebConstants.CURRENT_USER_PASSWORD_SET_TYPE,
|
||||
userInfo.getPasswordSetType());
|
||||
return;
|
||||
} else {
|
||||
WebContext.getSession().setAttribute(WebConstants.CURRENT_USER_PASSWORD_SET_TYPE,
|
||||
ConstantsPasswordSetType.PASSWORD_NORMAL);
|
||||
ConstsPasswordSetType.PASSWORD_NORMAL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -206,7 +206,7 @@ public class PasswordPolicyValidator {
|
||||
);
|
||||
if (intDuration > passwordPolicy.getExpiration()) {
|
||||
WebContext.getSession().setAttribute(WebConstants.CURRENT_USER_PASSWORD_SET_TYPE,
|
||||
ConstantsPasswordSetType.PASSWORD_EXPIRED);
|
||||
ConstsPasswordSetType.PASSWORD_EXPIRED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,9 +222,9 @@ public class PasswordPolicyValidator {
|
||||
try {
|
||||
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getId())) {
|
||||
jdbcTemplate.update(LOCK_USER_UPDATE_STATEMENT,
|
||||
new Object[] { ConstantsStatus.LOCK, new Date(), userInfo.getId() },
|
||||
new Object[] { ConstsStatus.LOCK, new Date(), userInfo.getId() },
|
||||
new int[] { Types.VARCHAR, Types.TIMESTAMP, Types.VARCHAR });
|
||||
userInfo.setIsLocked(ConstantsStatus.LOCK);
|
||||
userInfo.setIsLocked(ConstsStatus.LOCK);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
_logger.error("lockUser Exception",e);
|
||||
@@ -241,9 +241,9 @@ public class PasswordPolicyValidator {
|
||||
try {
|
||||
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getId())) {
|
||||
jdbcTemplate.update(UNLOCK_USER_UPDATE_STATEMENT,
|
||||
new Object[] { ConstantsStatus.ACTIVE, new Date(), userInfo.getId() },
|
||||
new Object[] { ConstsStatus.ACTIVE, new Date(), userInfo.getId() },
|
||||
new int[] { Types.VARCHAR, Types.TIMESTAMP, Types.VARCHAR });
|
||||
userInfo.setIsLocked(ConstantsStatus.ACTIVE);
|
||||
userInfo.setIsLocked(ConstsStatus.ACTIVE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
_logger.error("unlockUser Exception",e);
|
||||
@@ -259,9 +259,9 @@ public class PasswordPolicyValidator {
|
||||
try {
|
||||
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getId())) {
|
||||
jdbcTemplate.update(BADPASSWORDCOUNT_RESET_UPDATE_STATEMENT,
|
||||
new Object[] { 0, ConstantsStatus.ACTIVE, new Date(), userInfo.getId() },
|
||||
new Object[] { 0, ConstsStatus.ACTIVE, new Date(), userInfo.getId() },
|
||||
new int[] { Types.INTEGER, Types.INTEGER, Types.TIMESTAMP, Types.VARCHAR });
|
||||
userInfo.setIsLocked(ConstantsStatus.ACTIVE);
|
||||
userInfo.setIsLocked(ConstsStatus.ACTIVE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
_logger.error("resetAttempts Exception",e);
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.Map;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.maxkey.constants.ConstantsTimeInterval;
|
||||
import org.maxkey.constants.ConstsTimeInterval;
|
||||
import org.maxkey.web.WebConstants;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.slf4j.Logger;
|
||||
@@ -77,7 +77,7 @@ public class ThemeTagDirective implements TemplateDirectiveModel {
|
||||
&& null != WebContext.getUserInfo()) {
|
||||
request.setAttribute(WebConstants.THEME_COOKIE_NAME, "theme");
|
||||
WebContext.setCookie(response, null,
|
||||
WebConstants.THEME_COOKIE_NAME, theme, ConstantsTimeInterval.ONE_WEEK);
|
||||
WebConstants.THEME_COOKIE_NAME, theme, ConstsTimeInterval.ONE_WEEK);
|
||||
}
|
||||
|
||||
env.getOut().append(theme == null ? "default" : theme);
|
||||
|
||||
Reference in New Issue
Block a user