限制小程序只能登陆本appId范围内的用户
This commit is contained in:
parent
d771c1ba5c
commit
baac92bb5c
|
|
@ -11,6 +11,7 @@ import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import me.chanjar.weixin.common.error.WxErrorException;
|
import me.chanjar.weixin.common.error.WxErrorException;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.common.constant.MallConstants;
|
import org.jeecg.common.constant.MallConstants;
|
||||||
import org.jeecg.common.constant.MyReturnCode;
|
import org.jeecg.common.constant.MyReturnCode;
|
||||||
import org.jeecg.common.dto.LoginDTO;
|
import org.jeecg.common.dto.LoginDTO;
|
||||||
|
|
@ -371,8 +372,16 @@ public class UserInfoController {
|
||||||
UserInfo userInfo = userInfoService.getOne(Wrappers.<UserInfo>query().lambda()
|
UserInfo userInfo = userInfoService.getOne(Wrappers.<UserInfo>query().lambda()
|
||||||
.eq(UserInfo::getUserName, userInfoLoginDTO.getUserName()));
|
.eq(UserInfo::getUserName, userInfoLoginDTO.getUserName()));
|
||||||
if(userInfo == null){
|
if(userInfo == null){
|
||||||
return R.failed("账户不存在,请联系管理员");
|
return R.failed("登陆错误000");
|
||||||
}
|
}
|
||||||
|
String appId = ApiUtil.getAppId(request);
|
||||||
|
if(StringUtils.isBlank(appId)){
|
||||||
|
return R.failed("登陆错误001");
|
||||||
|
}
|
||||||
|
if(!appId.equals(userInfo.getAppId())){
|
||||||
|
return R.failed("登陆错误002");
|
||||||
|
}
|
||||||
|
|
||||||
//校验账号密码
|
//校验账号密码
|
||||||
if(StrUtil.isBlank(userInfo.getPassword()) ||
|
if(StrUtil.isBlank(userInfo.getPassword()) ||
|
||||||
!ENCODER.matches(userInfoLoginDTO.getPassword(),userInfo.getPassword())){
|
!ENCODER.matches(userInfoLoginDTO.getPassword(),userInfo.getPassword())){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue