2
0

feat: add i18n

This commit is contained in:
caiyuchao
2024-11-25 19:22:30 +08:00
parent 887db97ea3
commit 77a28b06a3
18 changed files with 347 additions and 25 deletions

View File

@@ -1,16 +1,9 @@
package org.wfc.gateway.service.impl;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import com.google.code.kaptcha.Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.FastByteArrayOutputStream;
import com.google.code.kaptcha.Producer;
import org.wfc.common.core.constant.CacheConstants;
import org.wfc.common.core.constant.Constants;
import org.wfc.common.core.exception.CaptchaException;
@@ -22,6 +15,14 @@ import org.wfc.common.redis.service.RedisService;
import org.wfc.gateway.config.properties.CaptchaProperties;
import org.wfc.gateway.service.ValidateCodeService;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* 验证码实现处理
*
@@ -105,18 +106,18 @@ public class ValidateCodeServiceImpl implements ValidateCodeService
{
if (StringUtils.isEmpty(code))
{
throw new CaptchaException("验证码不能为空");
throw new CaptchaException("user.jcaptcha.not.blank");
}
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
String captcha = redisService.getCacheObject(verifyKey);
if (captcha == null)
{
throw new CaptchaException("验证码已失效");
throw new CaptchaException();
}
redisService.deleteObject(verifyKey);
if (!code.equalsIgnoreCase(captcha))
{
throw new CaptchaException("验证码错误");
throw new CaptchaException();
}
}
}