mirror of https://gitee.com/stylefeng/roses
【7.0.4】【captcha】更新验证码过期时间
parent
f4391ab4a3
commit
485a01cdec
|
@ -34,9 +34,9 @@ import org.springframework.data.redis.core.RedisTemplate;
|
||||||
* @author chenjinlong
|
* @author chenjinlong
|
||||||
* @date 2021/1/15 13:44
|
* @date 2021/1/15 13:44
|
||||||
*/
|
*/
|
||||||
public class CaptchaRedisCache extends AbstractRedisCacheOperator<Long> {
|
public class CaptchaRedisCache extends AbstractRedisCacheOperator<String> {
|
||||||
|
|
||||||
public CaptchaRedisCache(RedisTemplate<String, Long> redisTemplate) {
|
public CaptchaRedisCache(RedisTemplate<String, String> redisTemplate) {
|
||||||
super(redisTemplate);
|
super(redisTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ package cn.stylefeng.roses.kernel.security.starter;
|
||||||
|
|
||||||
import cn.hutool.cache.CacheUtil;
|
import cn.hutool.cache.CacheUtil;
|
||||||
import cn.hutool.cache.impl.TimedCache;
|
import cn.hutool.cache.impl.TimedCache;
|
||||||
import cn.stylefeng.roses.kernel.cache.api.constants.CacheConstants;
|
|
||||||
import cn.stylefeng.roses.kernel.security.api.CaptchaApi;
|
import cn.stylefeng.roses.kernel.security.api.CaptchaApi;
|
||||||
import cn.stylefeng.roses.kernel.security.captcha.CaptchaService;
|
import cn.stylefeng.roses.kernel.security.captcha.CaptchaService;
|
||||||
import cn.stylefeng.roses.kernel.security.captcha.cache.CaptchaMemoryCache;
|
import cn.stylefeng.roses.kernel.security.captcha.cache.CaptchaMemoryCache;
|
||||||
|
@ -52,7 +51,8 @@ public class CaptchaAutoConfiguration {
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean(CaptchaApi.class)
|
@ConditionalOnMissingBean(CaptchaApi.class)
|
||||||
public CaptchaApi captchaApi() {
|
public CaptchaApi captchaApi() {
|
||||||
TimedCache<String, String> timedCache = CacheUtil.newTimedCache(CacheConstants.NONE_EXPIRED_TIME);
|
// 验证码过期时间 120秒
|
||||||
|
TimedCache<String, String> timedCache = CacheUtil.newTimedCache(1000 * 120);
|
||||||
CaptchaMemoryCache captchaMemoryCache = new CaptchaMemoryCache(timedCache);
|
CaptchaMemoryCache captchaMemoryCache = new CaptchaMemoryCache(timedCache);
|
||||||
return new CaptchaService(captchaMemoryCache);
|
return new CaptchaService(captchaMemoryCache);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue