perf:验证码校验调整
This commit is contained in:
@@ -61,24 +61,21 @@ public class TimedCacheService {
|
||||
* @param session
|
||||
* @param value
|
||||
*/
|
||||
public void setImageCode(String session, String value) {
|
||||
putCache(session, value);
|
||||
public void setImageCode(String captcha, String value) {
|
||||
putCache(captcha, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 验证 图片验证码
|
||||
* 该验证兼容V2的图片验证码
|
||||
*
|
||||
* @param session
|
||||
*/
|
||||
public void verifyImage(String session, String value) {
|
||||
public void verifyImage(String value) {
|
||||
String captchaKey = ServletUtil.getHeader(ServletKit.getRequest(), "captcha", "utf-8");
|
||||
String cache = !StrUtil.isEmpty(captchaKey) ? getCache(captchaKey) : getCache(session);
|
||||
String cache = getCache(captchaKey);
|
||||
if (StrUtil.isEmpty(cache) || !StrUtil.equals(cache, value)) {
|
||||
throw new ApiException("验证码不正确");
|
||||
}
|
||||
clearByKey(session);
|
||||
clearByKey(captchaKey);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user