forked from github/dataease
fix: 登录功能序列化报错
This commit is contained in:
parent
97bc92118b
commit
f6f8882485
@ -6,9 +6,8 @@ import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class SysUserEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7606000748052557474L;
|
||||
public class SysUserEntity implements Serializable {
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
private Long userId;
|
||||
@ -45,6 +44,4 @@ public class SysUserEntity implements Serializable {
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
private Integer from;
|
||||
@ApiModelProperty(hidden = true)
|
||||
private Long pwdResetTime;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ public class AuthServer implements AuthApi {
|
||||
if (user.getIsAdmin()) {
|
||||
result.put("validityPeriod", -1);
|
||||
} else {
|
||||
Integer validityPeriod = systemParameterService.pwdValidityPeriod(user.getPwdResetTime());
|
||||
Integer validityPeriod = systemParameterService.pwdValidityPeriod(user.getUserId());
|
||||
if (validityPeriod.equals(0)) {
|
||||
DataEaseException.throwException("pwdValidityPeriod");
|
||||
}
|
||||
|
@ -14,7 +14,6 @@
|
||||
<result column="is_admin" jdbcType="BIT" property="isAdmin"/>
|
||||
<result column="from" property="from"/>
|
||||
<result column="dept_name" property="deptName"/>
|
||||
<result column="pwd_reset_time" jdbcType="BIGINT" property="pwdResetTime"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="roleMap" type="io.dataease.auth.api.dto.CurrentRoleDto">
|
||||
@ -49,7 +48,6 @@
|
||||
password,
|
||||
enabled,
|
||||
email,
|
||||
pwd_reset_time,
|
||||
phone,
|
||||
language,
|
||||
is_admin,
|
||||
|
@ -1,5 +1,7 @@
|
||||
package io.dataease.ext;
|
||||
|
||||
public interface ExtSystemParameterMapper {
|
||||
String email();
|
||||
String email();
|
||||
|
||||
long queryPwdResetTime(Long userId);
|
||||
}
|
||||
|
@ -5,4 +5,8 @@
|
||||
<select id="email" resultType="string">
|
||||
select param_value from system_parameter where param_key=#{smtp.account}
|
||||
</select>
|
||||
|
||||
<select id="queryPwdResetTime" resultType="Long">
|
||||
select pwd_reset_time from sys_user where user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -298,15 +298,17 @@ public class SystemParameterService {
|
||||
return param.getParamValue();
|
||||
}
|
||||
|
||||
public Integer pwdValidityPeriod(Long pwdTime) {
|
||||
if (ObjectUtils.isEmpty(pwdTime)) {
|
||||
return -1;
|
||||
}
|
||||
public Integer pwdValidityPeriod(Long userId) {
|
||||
|
||||
Map<String, LoginLimitXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType((LoginLimitXpackService.class));
|
||||
boolean loginLimitPluginLoaded = beansOfType.keySet().size() > 0;
|
||||
if (!loginLimitPluginLoaded) return -1;
|
||||
String value = getValue(LOGIN_LIMIT_OPEN_MODIFY_PWD.getValue());
|
||||
if (StringUtils.isNotBlank(value) && StringUtils.equals("true", value)) {
|
||||
long pwdTime = extSystemParameterMapper.queryPwdResetTime(userId);
|
||||
if (ObjectUtils.isEmpty(pwdTime)) {
|
||||
return -1;
|
||||
}
|
||||
long dayTime = 24 * 3600L * 1000L;
|
||||
String pwdCycle = getValue(LOGIN_LIMIT_PWD_CYCLE.getValue());
|
||||
Long expireCycle = null;
|
||||
|
Loading…
Reference in New Issue
Block a user