mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
add 增加验证码开关
This commit is contained in:
@ -52,6 +52,12 @@ public class CaptchaController {
|
||||
*/
|
||||
@GetMapping("/captchaImage")
|
||||
public AjaxResult getCode() {
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
Boolean enabled = captchaProperties.getEnabled();
|
||||
ajax.put("enabled", enabled);
|
||||
if (!enabled) {
|
||||
return AjaxResult.success(ajax);
|
||||
}
|
||||
// 保存验证码信息
|
||||
String uuid = IdUtil.simpleUUID();
|
||||
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
|
||||
@ -90,7 +96,6 @@ public class CaptchaController {
|
||||
code = captcha.getCode();
|
||||
}
|
||||
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||
Map<String,Object> ajax = new HashMap<>();
|
||||
ajax.put("uuid", uuid);
|
||||
ajax.put("img", captcha.getImageBase64());
|
||||
return AjaxResult.success(ajax);
|
||||
|
@ -14,6 +14,8 @@ ruoyi:
|
||||
addressEnabled: false
|
||||
|
||||
captcha:
|
||||
# 验证码开关
|
||||
enabled: true
|
||||
# 验证码类型 math 数组计算 char 字符验证
|
||||
type: math
|
||||
# line 线段干扰 circle 圆圈干扰 shear 扭曲干扰
|
||||
|
Reference in New Issue
Block a user