12345678910111213141516171819202122 |
- package com.ruoyi.system.utils;
- import com.ruoyi.common.constant.CacheConstants;
- import com.ruoyi.common.core.redis.RedisCache;
- import com.ruoyi.common.utils.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- public class CaptchaUtils {
- @Autowired
- private RedisCache redisCache;
- public Boolean validateCaptcha(String code, String uuid) {
- String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
- String captcha = redisCache.getCacheObject(verifyKey);
- redisCache.deleteObject(verifyKey);
- if (captcha.equals(code)){
- return true;
- }else {
- return false;
- }
- }
- }
|