滑块验证实现
GitHub地址:https://github.com/anji-plus/captcha/blob/master/README_CN.md
AJ-Captcha文档:https://ajcaptcha.beliefteam.cn/captcha-doc/
本人是spring boot – vue 项目:
一、后端
1)首先引入maven:
<dependency>
<groupId>com.anji-plus</groupId>
<artifactId>spring-boot-starter-captcha</artifactId>
<version>1.3.0</version>
</dependency>
2)再在application.yml中自定义水印,直接启动后前端就可以请求接口了
我这边就写了最简单的,具体可以看文档
# 验证码相关
aj:
captcha:
#jigsaw: classpath:images/jigsaw
cache-type: redis
water-mark: 水印-哒不溜
3)重写CaptchaCacheServiceRedisImpl
因为这个插件原本自带的impl好像有点问题,你们也可以不重写先试试;
①先新建一个文件夹
FileName:com.anji.captcha.service.CaptchaCacheService
内容:写自己的路径
②重写impl
我直接把内容复制出来吧,新建CaptchaCacheServiceRedisImpl
import com.anji.captcha.service.CaptchaCacheService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.bean