From f147a6ae7f543f6db757b3933adaf8f10b896ccf Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期一, 20 一月 2025 19:23:17 +0800 Subject: [PATCH] 合并代码 --- 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