app端请求登陆模块接口部分,获取验证码接口无法请求问题修改
This commit is contained in:
parent
e9c186c9d7
commit
d3d84a1c83
|
@ -34,18 +34,12 @@ public interface SystemClient {
|
|||
* @return
|
||||
*/
|
||||
@RequestMapping("/mlogout")
|
||||
Result<Object> logout(@RequestBody HttpServletRequest request);
|
||||
Result<Object> logout(@RequestParam HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 图形验证码
|
||||
*/
|
||||
@GetMapping("/mRandomImage/{key}")
|
||||
@GetMapping("/randomImage/{key}")
|
||||
Result<String> randomImage(@PathVariable("key") String key);
|
||||
|
||||
/**
|
||||
* 图形验证码
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/mCheckCaptcha")
|
||||
Result<?> checkCaptcha();
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ public class LoginController {
|
|||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/mlogout")
|
||||
public Result<Object> mlogout(@RequestBody HttpServletRequest request) {
|
||||
public Result<Object> mlogout(@RequestParam HttpServletRequest request) {
|
||||
//用户退出逻辑
|
||||
String token = request.getHeader(CommonConstant.X_ACCESS_TOKEN);
|
||||
if(oConvertUtils.isEmpty(token)) {
|
||||
|
@ -536,12 +536,11 @@ public class LoginController {
|
|||
|
||||
/**
|
||||
* 后台生成图形验证码 :有效
|
||||
* @param response
|
||||
* @param key
|
||||
*/
|
||||
@ApiOperation("获取验证码")
|
||||
@GetMapping(value = "/randomImage/{key}")
|
||||
public Result<String> randomImage(HttpServletResponse response,@PathVariable("key") String key){
|
||||
public Result<String> randomImage(@PathVariable("key") String key){
|
||||
Result<String> res = new Result<String>();
|
||||
try {
|
||||
//生成验证码
|
||||
|
@ -569,40 +568,6 @@ public class LoginController {
|
|||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* app端后台生成图形验证码 :有效
|
||||
* @param key
|
||||
*/
|
||||
@ApiOperation("获取验证码")
|
||||
@GetMapping(value = "/mRandomImage/{key}")
|
||||
public Result<String> mRandomImage(@PathVariable("key") String key){
|
||||
Result<String> res = new Result<String>();
|
||||
try {
|
||||
//生成验证码
|
||||
String code = RandomUtil.randomString(BASE_CHECK_CODES,4);
|
||||
//存到redis中
|
||||
String lowerCaseCode = code.toLowerCase();
|
||||
|
||||
//update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906
|
||||
// 加入密钥作为混淆,避免简单的拼接,被外部利用,用户自定义该密钥即可
|
||||
String origin = lowerCaseCode+key+jeecgBaseConfig.getSignatureSecret();
|
||||
String realKey = Md5Util.md5Encode(origin, "utf-8");
|
||||
//update-end-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906
|
||||
|
||||
redisUtil.set(realKey, lowerCaseCode, 60);
|
||||
log.info("获取验证码,Redis key = {},checkCode = {}", realKey, code);
|
||||
//返回前端
|
||||
String base64 = RandImageUtil.generate(code);
|
||||
res.setSuccess(true);
|
||||
res.setResult(base64);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
res.error500("获取验证码失败,请检查redis配置!");
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换菜单表为vue3的表
|
||||
*/
|
||||
|
@ -746,27 +711,6 @@ public class LoginController {
|
|||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* app端图形验证码
|
||||
* @param sysLoginModel
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/mCheckCaptcha", method = RequestMethod.POST)
|
||||
public Result<?> mCheckCaptcha(@RequestBody SysLoginModel sysLoginModel){
|
||||
String captcha = sysLoginModel.getCaptcha();
|
||||
String checkKey = sysLoginModel.getCheckKey();
|
||||
if(captcha==null){
|
||||
return Result.error("验证码无效");
|
||||
}
|
||||
String lowerCaseCaptcha = captcha.toLowerCase();
|
||||
String realKey = Md5Util.md5Encode(lowerCaseCaptcha+checkKey, "utf-8");
|
||||
Object checkCode = redisUtil.get(realKey);
|
||||
if(checkCode==null || !checkCode.equals(lowerCaseCaptcha)) {
|
||||
return Result.error("验证码错误");
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录二维码
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user