| | |
| | | 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; |
| | |
| | | @Autowired |
| | | private Producer producer; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | /** |
| | | * 生成验证码 |
| | | */ |
| | |
| | | |
| | | // 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; |