diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/captcha/CaptchaController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/captcha/CaptchaController.java new file mode 100644 index 000000000..db2bc0cd4 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/captcha/CaptchaController.java @@ -0,0 +1,42 @@ +package cn.iocoder.yudao.module.system.controller.admin.captcha; + +import com.anji.captcha.model.common.ResponseModel; +import com.anji.captcha.model.vo.CaptchaVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.security.PermitAll; +import javax.servlet.http.HttpServletRequest; + +/** + * 验证码 + * + * 问题:为什么不直接使用 anji 提供的 CaptchaController,而要另外继承? + * 回答:管理使用 /admin-api/* 作为前缀,所以需要继承! + * + * @author 芋道源码 + */ +@Api(tags = "管理后台 - 验证码") +@RestController("adminCaptchaController") +@RequestMapping("/captcha") +public class CaptchaController extends com.anji.captcha.controller.CaptchaController { + + @PostMapping({"/get"}) + @ApiOperation("获得验证码") + @PermitAll + public ResponseModel get(@RequestBody CaptchaVO data, HttpServletRequest request) { + return super.get(data, request); + } + + @PostMapping({"/check"}) + @ApiOperation("校验验证码") + @PermitAll + public ResponseModel check(@RequestBody CaptchaVO data, HttpServletRequest request) { + return super.check(data, request); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/application.yaml b/yudao-module-system/yudao-module-system-biz/src/main/resources/application.yaml index a60248fc0..1846b2253 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/application.yaml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/application.yaml @@ -102,7 +102,7 @@ aj: timing-clear: 180 # local定时清除过期缓存(单位秒),设置为0代表不执行 type: blockPuzzle # 验证码类型 default两种都实例化。 blockPuzzle 滑块拼图 clickWord 文字点选 water-mark: 芋道源码 # 右下角水印文字(我的水印),可使用 https://tool.chinaz.com/tools/unicode.aspx 中文转 Unicode,Linux 可能需要转 unicode - interference-options: 2 # 滑动干扰项(0/1/2) + interference-options: 0 # 滑动干扰项(0/1/2) req-frequency-limit-enable: false # 接口请求次数一分钟限制是否开启 true|false req-get-lock-limit: 5 # 验证失败5次,get接口锁定 req-get-lock-seconds: 10 # 验证失败后,锁定时间间隔 @@ -134,6 +134,8 @@ yudao: ignore-urls: - /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号 - /admin-api/system/captcha/get-image # 获取图片验证码,和租户无关 + - /admin-api/captcha/get # 获取图片验证码,和租户无关 + - /admin-api/captcha/check # 校验图片验证码,和租户无关 - /admin-api/system/sms/callback/* # 短信回调接口,无法带上租户编号 - /rpc-api/system/tenant/valid # 防止递归。避免调用 /rpc-api/system/tenant/valid 接口时,又去触发 /rpc-api/system/tenant/valid 去校验 - /rpc-api/system/tenant/id-list # 获得租户列表的时候,无需传递租户编号