forked from github/dataease
fix: 用户停用还可以登录
This commit is contained in:
parent
787123ae4a
commit
65d1808488
@ -68,6 +68,9 @@ public class F2CRealm extends AuthorizingRealm {
|
|||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new AuthenticationException("User didn't existed!");
|
throw new AuthenticationException("User didn't existed!");
|
||||||
}
|
}
|
||||||
|
if (user.getEnabled()==0) {
|
||||||
|
throw new AuthenticationException("User is valid!");
|
||||||
|
}
|
||||||
String pass = null;
|
String pass = null;
|
||||||
try {
|
try {
|
||||||
pass = user.getPassword();
|
pass = user.getPassword();
|
||||||
|
@ -35,10 +35,14 @@ public class AuthServer implements AuthApi {
|
|||||||
String username = loginDto.getUsername();
|
String username = loginDto.getUsername();
|
||||||
String password = loginDto.getPassword();
|
String password = loginDto.getPassword();
|
||||||
SysUserEntity user = authUserService.getUserByName(username);
|
SysUserEntity user = authUserService.getUserByName(username);
|
||||||
String realPwd = user.getPassword();
|
|
||||||
if (ObjectUtils.isEmpty(user)){
|
if (ObjectUtils.isEmpty(user)){
|
||||||
throw new RuntimeException("没有该用户!");
|
throw new RuntimeException("没有该用户!");
|
||||||
}
|
}
|
||||||
|
if (user.getEnabled()==0){
|
||||||
|
throw new RuntimeException("用户已经失效!");
|
||||||
|
}
|
||||||
|
String realPwd = user.getPassword();
|
||||||
//私钥解密
|
//私钥解密
|
||||||
String pwd = RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, password);
|
String pwd = RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, password);
|
||||||
//md5加密
|
//md5加密
|
||||||
|
@ -15,12 +15,12 @@ import io.dataease.controller.sys.base.BaseGridRequest;
|
|||||||
import io.dataease.controller.sys.request.SysUserCreateRequest;
|
import io.dataease.controller.sys.request.SysUserCreateRequest;
|
||||||
import io.dataease.controller.sys.request.SysUserPwdRequest;
|
import io.dataease.controller.sys.request.SysUserPwdRequest;
|
||||||
import io.dataease.controller.sys.request.SysUserStateRequest;
|
import io.dataease.controller.sys.request.SysUserStateRequest;
|
||||||
import io.dataease.controller.sys.request.UserGridRequest;
|
|
||||||
import io.dataease.controller.sys.response.SysUserGridResponse;
|
import io.dataease.controller.sys.response.SysUserGridResponse;
|
||||||
import io.dataease.controller.sys.response.SysUserRole;
|
import io.dataease.controller.sys.response.SysUserRole;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -31,7 +31,10 @@ import java.util.stream.Collectors;
|
|||||||
@Service
|
@Service
|
||||||
public class SysUserService {
|
public class SysUserService {
|
||||||
|
|
||||||
private final static String DEFAULT_PWD = "DataEase123..";
|
//private final static String DEFAULT_PWD = "DataEase123..";
|
||||||
|
|
||||||
|
@Value("${dataease.init_password:DataEase123..}")
|
||||||
|
private String DEFAULT_PWD;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SysUserMapper sysUserMapper;
|
private SysUserMapper sysUserMapper;
|
||||||
@ -89,6 +92,7 @@ public class SysUserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||||
public int updateStatus(SysUserStateRequest request){
|
public int updateStatus(SysUserStateRequest request){
|
||||||
SysUser sysUser = new SysUser();
|
SysUser sysUser = new SysUser();
|
||||||
sysUser.setUserId(request.getUserId());
|
sysUser.setUserId(request.getUserId());
|
||||||
|
Loading…
Reference in New Issue
Block a user