Skip to content

Commit

Permalink
Merge branch 'master-jdk21' of https://gitee.com/zhijiantianya/yudao-…
Browse files Browse the repository at this point in the history
…cloud

# Conflicts:
#	yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/config/YudaoCaptchaConfiguration.java
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/core/RedisCaptchaServiceImpl.java
  • Loading branch information
YunaiV committed Feb 28, 2024
2 parents 6a53dc9 + c3eae20 commit 03b0727
Show file tree
Hide file tree
Showing 49 changed files with 46 additions and 132 deletions.
10 changes: 0 additions & 10 deletions yudao-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,6 @@
<artifactId>yudao-spring-boot-starter-biz-ip</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-captcha</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-desensitize</artifactId>
<version>${revision}</version>
</dependency>

<!-- Spring 核心 -->
<dependency>
Expand Down
1 change: 0 additions & 1 deletion yudao-framework/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
<module>yudao-spring-boot-starter-biz-ip</module>

<module>yudao-spring-boot-starter-flowable</module>
<module>yudao-spring-boot-starter-captcha</module>
<module>yudao-spring-boot-starter-websocket</module>
</modules>

Expand Down
39 changes: 0 additions & 39 deletions yudao-framework/yudao-spring-boot-starter-captcha/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 4 additions & 5 deletions yudao-module-system/yudao-module-system-biz/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@
<artifactId>yudao-spring-boot-starter-excel</artifactId>
</dependency>

<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-captcha</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
Expand Down Expand Up @@ -173,6 +168,10 @@
<artifactId>tencentcloud-sdk-java-sms</artifactId> <!-- 短信(腾讯云) -->
</dependency>

<dependency>
<groupId>com.xingyuv</groupId>
<artifactId>spring-boot-starter-captcha-plus</artifactId> <!-- 验证码,一般用于登录使用 -->
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}

}
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
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 javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

/**
* 基于 Redis 实现验证码的存储
*
* @author 星语
*/
@NoArgsConstructor // 保证 aj-captcha 的 SPI 创建
@AllArgsConstructor
@Setter
public class RedisCaptchaServiceImpl implements CaptchaCacheService {

@Resource // 保证 aj-captcha 的 SPI 创建时的注入
private StringRedisTemplate stringRedisTemplate;

@Override
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);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* 验证码拓展
*
* 基于 aj-captcha 实现滑块验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/
*
* @author 星语
*/
package cn.iocoder.yudao.module.system.framework.captcha;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cn.iocoder.yudao.module.system.framework.captcha.core.RedisCaptchaServiceImpl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 03b0727

Please sign in to comment.