From 9486766c806fe1d9e082b2fd02ea1cc558f1b443 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 08 五月 2025 09:21:57 +0800
Subject: [PATCH] bug修改

---
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/KaptchaController.java |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/KaptchaController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/KaptchaController.java
index 469f65f..a2efca3 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/KaptchaController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/KaptchaController.java
@@ -1,5 +1,6 @@
 package com.dsh.guns.modular.system.controller.system;
 
+import com.dsh.course.util.RedisUtil;
 import com.dsh.guns.config.properties.GunsProperties;
 import com.dsh.guns.core.util.FileUtil;
 import com.google.code.kaptcha.Constants;
@@ -23,6 +24,7 @@
  * @author fengshuonan
  * @date 2017-05-05 23:10
  */
+
 @Controller
 @RequestMapping("/kaptcha")
 public class KaptchaController {
@@ -32,6 +34,9 @@
 
     @Autowired
     private Producer producer;
+
+    @Autowired
+    private RedisUtil redisUtil;
 
     /**
      * 生成验证码
@@ -56,10 +61,11 @@
 
         // create the text for the image
         String capText = producer.createText();
-
+        String cookie = request.getHeader("cookie");
+        System.err.println("cookie:" + cookie);
+        redisUtil.setStrValue(cookie, capText, 300);
         // store the text in the session
         session.setAttribute(Constants.KAPTCHA_SESSION_KEY, capText);
-
         // create the image with the text
         BufferedImage bi = producer.createImage(capText);
         ServletOutputStream out = null;

--
Gitblit v1.7.1