From de1a6d749a3f850c8571aa8a01878c61e5cff239 Mon Sep 17 00:00:00 2001 From: GPU is all you need <2778335106@qq.com> Date: Mon, 21 Mar 2022 17:30:00 +0800 Subject: [PATCH] =?UTF-8?q?2022/3/21=20=E5=9B=9E=E9=80=80=E5=88=B0?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E7=9A=84=E6=A0=B7=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edu/ncst/award/controller/CaptchaController.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/awardBE/src/main/java/edu/ncst/award/controller/CaptchaController.java b/awardBE/src/main/java/edu/ncst/award/controller/CaptchaController.java index 8bf7b14..b03f7b5 100644 --- a/awardBE/src/main/java/edu/ncst/award/controller/CaptchaController.java +++ b/awardBE/src/main/java/edu/ncst/award/controller/CaptchaController.java @@ -33,9 +33,14 @@ public class CaptchaController { String tempToken = null; Boolean tokenIsValid = false; - // 校验 TOKEN 是否存在 有效 + // 校验 TOKEN 是否存在 if (tempTokenCookie != null && tempTokenCookie.getValue() != null && !"".equals(tempTokenCookie.getValue())) { - tokenIsValid = stringRedisTemplate.hasKey("tempToken:" + tempTokenCookie.getValue()); + tempToken = tempTokenCookie.getValue(); + } + + // 校验 TOKEN 是否有效 + if (tempToken != null) { + tokenIsValid = stringRedisTemplate.hasKey("tempToken:" + tempToken); } // 如果没有 TOKEN 或者 TOKEN 失效都会生成一个新的TOKEN