添加滑块验证码

This commit is contained in:
yangjun 2025-07-29 14:59:26 +08:00
parent 6a28277197
commit 7bce639eb8
2 changed files with 33 additions and 0 deletions

View File

@ -88,6 +88,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/sys/cas/client/validateLogin", "anon"); //cas验证登录
filterChainDefinitionMap.put("/sys/randomImage/**", "anon"); //登录验证码接口排除
filterChainDefinitionMap.put("/sys/randomCode/**", "anon"); //登录验证码接口排除
filterChainDefinitionMap.put("/sys/randomInputCode/**", "anon"); //登录验证码接口排除
filterChainDefinitionMap.put("/sys/checkCaptcha", "anon"); //登录验证码接口排除
filterChainDefinitionMap.put("/sys/smsCheckCaptcha", "anon"); //短信次数发送太多验证码排除
filterChainDefinitionMap.put("/sys/login", "anon"); //登录接口排除

View File

@ -586,6 +586,38 @@ public class LoginController {
}
return res;
}
/**
* 后台生成图形验证码 有效
* @param response
* @param key
*/
@ApiOperation("获取验证码")
@GetMapping(value = "/randomInputCode/{key}")
public Result<String> randomInputCode(HttpServletResponse response,@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);
res.setSuccess(true);
res.setResult(code);
} catch (Exception e) {
log.error(e.getMessage(), e);
res.error500("获取验证码失败,请检查redis配置!");
return res;
}
return res;
}
/**
* 切换菜单表为vue3的表