security loginuser
This commit is contained in:
parent
f9cc1fb291
commit
45c1291aa5
|
|
@ -105,8 +105,6 @@ public class TokenController {
|
|||
LoginUser loginUser = custLogin(form);
|
||||
Map<String, Object> map = tokenService.createToken(loginUser);
|
||||
loginUser.setToken((String) map.get(CustTokenService.ACCESS_TOKEN));
|
||||
loginUser.setExpireIn((Long) map.get(CustTokenService.EXPIRES_IN));
|
||||
loginUser.setLogin((boolean) map.get(CustTokenService.IS_LOGIN));
|
||||
return R.ok(loginUser);
|
||||
}
|
||||
|
||||
|
|
@ -141,10 +139,9 @@ public class TokenController {
|
|||
if (Objects.isNull(result)) {
|
||||
throw new ServiceException("未找到用户");
|
||||
} else {
|
||||
result.setCustIdStr(result.getCustId().toString());
|
||||
if (CustLoginTypeEnum.getNeedPasswordLoginTypeToMap().containsKey(content.getLoginType())) {
|
||||
content.setPassword(AesEncryptUtil.aesDecode(content.getPassword()));
|
||||
if (!encoder.matches(content.getPassword(), result.getPwd())) {
|
||||
if (!encoder.matches(content.getPassword(), result.getPassword())) {
|
||||
throw new ServiceException("密码错误");
|
||||
}
|
||||
}
|
||||
|
|
@ -167,9 +164,9 @@ public class TokenController {
|
|||
CustCasual insertCasual = new CustCasual();
|
||||
openid = IdUtil.simpleUUID();
|
||||
insertCasual.setCasualId(Id.next()); //TODO, NPE
|
||||
insertCasual.setCasualName(SM4EncryptUtils.sm4Decrypt(result.getCustName()));
|
||||
insertCasual.setCasualName(SM4EncryptUtils.sm4Decrypt(result.getNickName()));
|
||||
insertCasual.setCustId(result.getCustId());
|
||||
insertCasual.setMobile(SM4EncryptUtils.sm4Decrypt(result.getMobile()));
|
||||
insertCasual.setMobile(SM4EncryptUtils.sm4Decrypt(result.getPhonenumber()));
|
||||
insertCasual.setOpenid(openid);
|
||||
insertCasual.setSourceType(sourceType);
|
||||
this.authCustCasualMapper.addCustCasual(insertCasual);
|
||||
|
|
@ -181,9 +178,9 @@ public class TokenController {
|
|||
}
|
||||
}
|
||||
|
||||
result.setOpenid(openid);
|
||||
result.setCustName(SM4EncryptUtils.sm4Decrypt(result.getCustName()));
|
||||
result.setMobile(SM4EncryptUtils.sm4Decrypt(result.getMobile()));
|
||||
result.setOpenId(openid);
|
||||
result.setNickName(SM4EncryptUtils.sm4Decrypt(result.getNickName()));
|
||||
result.setPhonenumber(SM4EncryptUtils.sm4Decrypt(result.getPhonenumber()));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,10 +74,10 @@ public class CustTokenService {
|
|||
delExistingToken(loginUser.getCustId());
|
||||
String token = IdUtils.fastUUID();
|
||||
Long custId = loginUser.getCustId();
|
||||
String userName = loginUser.getCustName();
|
||||
String userName = loginUser.getNickName();
|
||||
loginUser.setToken(token);
|
||||
loginUser.setCustId(custId);
|
||||
loginUser.setCustName(userName);
|
||||
loginUser.setNickName(userName);
|
||||
loginUser.setIpaddr(IpUtils.getIpAddr());
|
||||
refreshToken(loginUser);
|
||||
// Jwt存储信息
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<mapper namespace="com.bonus.auth.mapper.AuthCustInfoMapper">
|
||||
<!--根据人员id集合获取人员信息-->
|
||||
<select id="selectLoginInfo" resultType="com.bonus.system.api.model.LoginUser">
|
||||
select cust_id, cust_name, cust_num, cust_photo_url, mobile, pwd
|
||||
select cust_id as custId, open_id as openId, cust_name as nickName, cust_photo_url as photoUrl, mobile as phonenumber, pwd as password
|
||||
from cust_info
|
||||
<where>
|
||||
cust_state = 1 and (psn_type != 999 or psn_type is null)
|
||||
|
|
|
|||
Reference in New Issue