From c3eae200db22ff00a454f6884ed91de923a39751 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 28 Feb 2024 20:38:35 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E5=85=A8=E5=B1=80=EF=BC=9A?= =?UTF-8?q?=E7=AE=80=E5=8C=96=20captcha=20=E7=BB=84=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E8=9E=8D=E5=90=88=E5=88=B0=20system=20=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-dependencies/pom.xml | 10 ----- yudao-framework/pom.xml | 1 - .../yudao-spring-boot-starter-captcha/pom.xml | 39 ------------------ .../config/YudaoCaptchaConfiguration.java | 29 ------------- .../core/enums/CaptchaRedisKeyConstants.java | 28 ------------- .../yudao/framework/captcha/package-info.java | 7 ---- ...ingyuv.captcha.service.CaptchaCacheService | 1 - ...ot.autoconfigure.AutoConfiguration.imports | 1 - .../yudao-module-system-biz/pom.xml | 9 ++-- .../config/YudaoCaptchaConfiguration.java | 29 +++++++++++++ .../core}/RedisCaptchaServiceImpl.java | 14 ++----- .../framework/captcha/package-info.java | 8 ++++ ...ingyuv.captcha.service.CaptchaCacheService | 1 + .../resources/images/jigsaw/original/bg1.png | Bin .../resources/images/jigsaw/original/bg2.png | Bin .../resources/images/jigsaw/original/bg3.png | Bin .../resources/images/jigsaw/original/bg4.png | Bin .../resources/images/jigsaw/original/bg5.png | Bin .../resources/images/jigsaw/original/bg6.png | Bin .../resources/images/jigsaw/original/bg7.png | Bin .../resources/images/jigsaw/original/bg8.png | Bin .../resources/images/jigsaw/original/bg9.png | Bin .../images/jigsaw/slidingBlock/1.png | Bin .../images/jigsaw/slidingBlock/11/10.png | Bin .../images/jigsaw/slidingBlock/11/11.png | Bin .../images/jigsaw/slidingBlock/11/12.png | Bin .../images/jigsaw/slidingBlock/11/13.png | Bin .../images/jigsaw/slidingBlock/11/14.png | Bin .../images/jigsaw/slidingBlock/11/15.png | Bin .../images/jigsaw/slidingBlock/11/16.png | Bin .../images/jigsaw/slidingBlock/11/17.png | Bin .../images/jigsaw/slidingBlock/11/18.png | Bin .../images/jigsaw/slidingBlock/11/19.png | Bin .../images/jigsaw/slidingBlock/11/8.png | Bin .../images/jigsaw/slidingBlock/11/9.png | Bin .../images/jigsaw/slidingBlock/2.png | Bin .../images/jigsaw/slidingBlock/3.png | Bin .../images/jigsaw/slidingBlock/4.png | Bin .../main/resources/images/pic-click/bg1.png | Bin .../main/resources/images/pic-click/bg10.png | Bin .../main/resources/images/pic-click/bg2.png | Bin .../main/resources/images/pic-click/bg3.png | Bin .../main/resources/images/pic-click/bg4.png | Bin .../main/resources/images/pic-click/bg5.png | Bin .../main/resources/images/pic-click/bg6.png | Bin .../main/resources/images/pic-click/bg7.png | Bin .../main/resources/images/pic-click/bg8.png | Bin .../main/resources/images/pic-click/bg9.png | Bin .../auth/AdminAuthServiceImplTest.java | 13 +++++- 49 files changed, 56 insertions(+), 134 deletions(-) delete mode 100644 yudao-framework/yudao-spring-boot-starter-captcha/pom.xml delete mode 100644 yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/config/YudaoCaptchaConfiguration.java delete mode 100644 yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/enums/CaptchaRedisKeyConstants.java delete mode 100644 yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/package-info.java delete mode 100644 yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService delete mode 100644 yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/config/YudaoCaptchaConfiguration.java rename {yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/service => yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/core}/RedisCaptchaServiceImpl.java (71%) create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/package-info.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/original/bg1.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/original/bg2.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/original/bg3.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/original/bg4.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/original/bg5.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/original/bg6.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/original/bg7.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/original/bg8.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/original/bg9.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/1.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/11/10.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/11/11.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/11/12.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/11/13.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/11/14.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/11/15.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/11/16.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/11/17.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/11/18.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/11/19.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/11/8.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/11/9.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/2.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/3.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/jigsaw/slidingBlock/4.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/pic-click/bg1.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/pic-click/bg10.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/pic-click/bg2.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/pic-click/bg3.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/pic-click/bg4.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/pic-click/bg5.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/pic-click/bg6.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/pic-click/bg7.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/pic-click/bg8.png (100%) rename {yudao-framework/yudao-spring-boot-starter-captcha => yudao-module-system/yudao-module-system-biz}/src/main/resources/images/pic-click/bg9.png (100%) diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index e011c5f111..02b3b4137e 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -151,16 +151,6 @@ yudao-spring-boot-starter-biz-ip ${revision} - - cn.iocoder.cloud - yudao-spring-boot-starter-captcha - ${revision} - - - cn.iocoder.cloud - yudao-spring-boot-starter-desensitize - ${revision} - diff --git a/yudao-framework/pom.xml b/yudao-framework/pom.xml index 9d63f3079c..508a0fc5eb 100644 --- a/yudao-framework/pom.xml +++ b/yudao-framework/pom.xml @@ -36,7 +36,6 @@ yudao-spring-boot-starter-biz-ip yudao-spring-boot-starter-flowable - yudao-spring-boot-starter-captcha yudao-spring-boot-starter-websocket diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/pom.xml b/yudao-framework/yudao-spring-boot-starter-captcha/pom.xml deleted file mode 100644 index b77ef88865..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-captcha/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - cn.iocoder.cloud - yudao-framework - ${revision} - - 4.0.0 - yudao-spring-boot-starter-captcha - jar - - ${project.artifactId} - 验证码拓展 - 1. 基于 aj-captcha 实现滑块验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/ - - - - - - com.xingyuv - spring-boot-starter-captcha-plus - - - - org.springframework.boot - spring-boot-starter - - - - - cn.iocoder.cloud - yudao-spring-boot-starter-redis - - - - - diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/config/YudaoCaptchaConfiguration.java b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/config/YudaoCaptchaConfiguration.java deleted file mode 100644 index 78213b689b..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/config/YudaoCaptchaConfiguration.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.yudao.framework.captcha.config; - -import cn.iocoder.yudao.framework.captcha.core.service.RedisCaptchaServiceImpl; -import com.xingyuv.captcha.properties.AjCaptchaProperties; -import com.xingyuv.captcha.service.CaptchaCacheService; -import com.xingyuv.captcha.service.impl.CaptchaServiceFactory; -import org.springframework.boot.autoconfigure.AutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.data.redis.core.StringRedisTemplate; - -import jakarta.annotation.Resource; - -@AutoConfiguration -public class YudaoCaptchaConfiguration { - - @Resource - private StringRedisTemplate stringRedisTemplate; - - @Bean - public CaptchaCacheService captchaCacheService(AjCaptchaProperties config) { - // 缓存类型 redis/local/.... - CaptchaCacheService ret = CaptchaServiceFactory.getCache(config.getCacheType().name()); - if (ret instanceof RedisCaptchaServiceImpl) { - ((RedisCaptchaServiceImpl) ret).setStringRedisTemplate(stringRedisTemplate); - } - return ret; - } - -} diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/enums/CaptchaRedisKeyConstants.java b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/enums/CaptchaRedisKeyConstants.java deleted file mode 100644 index 5fa5b58584..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/enums/CaptchaRedisKeyConstants.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.yudao.framework.captcha.core.enums; - -/** - * 验证码 Redis Key 枚举类 - * - * @author 芋道源码 - */ -public interface CaptchaRedisKeyConstants { - - /** - * 验证码的请求限流 - * - * KEY 格式:AJ.CAPTCHA.REQ.LIMIT-%s-%s - * VALUE 数据类型:String // 例如说:验证失败 5 次,get 接口锁定 - * 过期时间:60 秒 - */ - String AJ_CAPTCHA_REQ_LIMIT = "AJ.CAPTCHA.REQ.LIMIT-%s-%s"; - - /** - * 验证码的坐标 - * - * KEY 格式:RUNNING:CAPTCHA:%s // AbstractCaptchaService.REDIS_CAPTCHA_KEY - * VALUE 数据类型:String // PointVO.class {"secretKey":"PP1w2Frr2KEejD2m","x":162,"y":5} - * 过期时间:120 秒 - */ - String AJ_CAPTCHA_RUNNING = "RUNNING:CAPTCHA:%s"; - -} diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/package-info.java b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/package-info.java deleted file mode 100644 index e78d9eab22..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -/** - * 验证码拓展 - * 1. 基于 aj-captcha 实现滑块验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/ - * - * @author 星语 - */ -package cn.iocoder.yudao.framework.captcha; diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService deleted file mode 100644 index afede97de0..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService +++ /dev/null @@ -1 +0,0 @@ -cn.iocoder.yudao.framework.captcha.core.service.RedisCaptchaServiceImpl diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index 8411d2cc34..0000000000 --- a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -cn.iocoder.yudao.framework.captcha.config.YudaoCaptchaConfiguration \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/pom.xml b/yudao-module-system/yudao-module-system-biz/pom.xml index 34ff5b4f3d..205a12ba34 100644 --- a/yudao-module-system/yudao-module-system-biz/pom.xml +++ b/yudao-module-system/yudao-module-system-biz/pom.xml @@ -129,11 +129,6 @@ yudao-spring-boot-starter-excel - - cn.iocoder.cloud - yudao-spring-boot-starter-captcha - - org.springframework.boot spring-boot-starter-mail @@ -173,6 +168,10 @@ tencentcloud-sdk-java-sms + + com.xingyuv + spring-boot-starter-captcha-plus + diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/config/YudaoCaptchaConfiguration.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/config/YudaoCaptchaConfiguration.java new file mode 100644 index 0000000000..23c8d78be2 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/config/YudaoCaptchaConfiguration.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.system.framework.captcha.config; + +import cn.iocoder.yudao.module.system.framework.captcha.core.RedisCaptchaServiceImpl; +import com.xingyuv.captcha.properties.AjCaptchaProperties; +import com.xingyuv.captcha.service.CaptchaCacheService; +import com.xingyuv.captcha.service.impl.CaptchaServiceFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.core.StringRedisTemplate; + +/** + * 验证码的配置类 + * + * @author 芋道源码 + */ +@Configuration(proxyBeanMethods = false) +public class YudaoCaptchaConfiguration { + + @Bean + public CaptchaCacheService captchaCacheService(AjCaptchaProperties config, + StringRedisTemplate stringRedisTemplate) { + CaptchaCacheService captchaCacheService = CaptchaServiceFactory.getCache(config.getCacheType().name()); + if (captchaCacheService instanceof RedisCaptchaServiceImpl) { + ((RedisCaptchaServiceImpl) captchaCacheService).setStringRedisTemplate(stringRedisTemplate); + } + return captchaCacheService; + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/service/RedisCaptchaServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/core/RedisCaptchaServiceImpl.java similarity index 71% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/service/RedisCaptchaServiceImpl.java rename to yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/core/RedisCaptchaServiceImpl.java index d3b19678b8..d69b88ccfe 100644 --- a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/service/RedisCaptchaServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/core/RedisCaptchaServiceImpl.java @@ -1,11 +1,9 @@ -package cn.iocoder.yudao.framework.captcha.core.service; +package cn.iocoder.yudao.module.system.framework.captcha.core; import com.xingyuv.captcha.service.CaptchaCacheService; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; +import lombok.Setter; import org.springframework.data.redis.core.StringRedisTemplate; -import jakarta.annotation.Resource; import java.util.concurrent.TimeUnit; /** @@ -13,11 +11,9 @@ * * @author 星语 */ -@NoArgsConstructor // 保证 aj-captcha 的 SPI 创建 -@AllArgsConstructor +@Setter public class RedisCaptchaServiceImpl implements CaptchaCacheService { - @Resource // 保证 aj-captcha 的 SPI 创建时的注入 private StringRedisTemplate stringRedisTemplate; @Override @@ -25,10 +21,6 @@ public String type() { return "redis"; } - public void setStringRedisTemplate(StringRedisTemplate stringRedisTemplate) { - this.stringRedisTemplate = stringRedisTemplate; - } - @Override public void set(String key, String value, long expiresInSeconds) { stringRedisTemplate.opsForValue().set(key, value, expiresInSeconds, TimeUnit.SECONDS); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/package-info.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/package-info.java new file mode 100644 index 0000000000..a94be215e1 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/package-info.java @@ -0,0 +1,8 @@ +/** + * 验证码拓展 + * + * 基于 aj-captcha 实现滑块验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/ + * + * @author 星语 + */ +package cn.iocoder.yudao.module.system.framework.captcha; \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService b/yudao-module-system/yudao-module-system-biz/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService new file mode 100644 index 0000000000..946ee59649 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService @@ -0,0 +1 @@ +cn.iocoder.yudao.module.system.framework.captcha.core.RedisCaptchaServiceImpl diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg1.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg1.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg1.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg1.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg2.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg2.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg2.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg2.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg3.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg3.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg3.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg3.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg4.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg4.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg4.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg4.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg5.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg5.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg5.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg5.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg6.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg6.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg6.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg6.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg7.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg7.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg7.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg7.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg8.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg8.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg8.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg8.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg9.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg9.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg9.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/original/bg9.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/1.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/1.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/1.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/1.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/10.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/10.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/10.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/10.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/11.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/11.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/11.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/11.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/12.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/12.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/12.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/12.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/13.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/13.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/13.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/13.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/14.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/14.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/14.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/14.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/15.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/15.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/15.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/15.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/16.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/16.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/16.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/16.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/17.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/17.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/17.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/17.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/18.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/18.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/18.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/18.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/19.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/19.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/19.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/19.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/8.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/8.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/8.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/8.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/9.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/9.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/9.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/11/9.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/2.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/2.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/2.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/2.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/3.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/3.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/3.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/3.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/4.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/4.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/4.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/jigsaw/slidingBlock/4.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg1.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg1.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg1.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg1.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg10.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg10.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg10.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg10.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg2.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg2.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg2.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg2.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg3.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg3.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg3.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg3.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg4.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg4.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg4.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg4.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg5.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg5.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg5.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg5.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg6.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg6.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg6.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg6.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg7.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg7.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg7.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg7.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg8.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg8.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg8.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg8.png diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg9.png b/yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg9.png similarity index 100% rename from yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg9.png rename to yudao-module-system/yudao-module-system-biz/src/main/resources/images/pic-click/bg9.png diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java index 9e31e080f8..d6709a0828 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java @@ -3,6 +3,7 @@ import cn.hutool.core.util.ReflectUtil; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi; import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO; @@ -32,6 +33,7 @@ import jakarta.validation.Validator; import static cn.hutool.core.util.RandomUtil.randomEle; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; @@ -208,8 +210,15 @@ public void testSendSmsCode() { public void testSmsLogin_success() { // 准备参数 String mobile = randomString(); - String scene = randomString(); - AuthSmsLoginReqVO reqVO = new AuthSmsLoginReqVO(mobile, scene); + String code = randomString(); + AuthSmsLoginReqVO reqVO = new AuthSmsLoginReqVO(mobile, code); + // mock 方法(校验验证码) + when(smsCodeApi.useSmsCode(argThat(reqDTO -> { + assertEquals(mobile, reqDTO.getMobile()); + assertEquals(code, reqDTO.getCode()); + assertEquals(SmsSceneEnum.ADMIN_MEMBER_LOGIN.getScene(), reqDTO.getScene()); + return true; + }))).thenReturn(success(true)); // mock 方法(用户信息) AdminUserDO user = randomPojo(AdminUserDO.class, o -> o.setId(1L)); when(userService.getUserByMobile(eq(mobile))).thenReturn(user);