Browse Source

优化登陆图形验证码

zouxuan 3 years ago
parent
commit
19c75245a1

+ 0 - 6
mec-auth/mec-auth-server/pom.xml

@@ -71,12 +71,6 @@
 		</dependency>
 
 		<dependency>
-			<groupId>com.github.penggle</groupId>
-			<artifactId>kaptcha</artifactId>
-			<version>2.3.2</version>
-		</dependency>
-
-		<dependency>
 			<groupId>com.ym</groupId>
 			<artifactId>mec-client-api</artifactId>
 		</dependency>

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java

@@ -9,6 +9,7 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     SMS_MUSIC_GROUP_ADD_STUDENT("SMS_MUSIC_GROUP_ADD_STUDENT", "入团通知"),
     SMS_MUSIC_GROUP_ADD_STUDENT_FREE("SMS_MUSIC_GROUP_ADD_STUDENT_FREE", "入团通知"),
     SMS_VERIFY_CODE_LOGIN("SMS_VERIFY_CODE_LOGIN", "验证码登录"),
+    KAPTCHA_SESSION_KEY("KAPTCHA_SESSION_KEY", "登录图形验证码"),
     SMS_PAYMENT_MESSAGE("SMS_PAYMENT_MESSAGE", "缴费通知"),
     SMS_PAYMENT_SUCCESS("SMS_PAYMENT_SUCCESS", "缴费成功"),
     SMS_RENEW_SUCCESS("SMS_RENEW_SUCCESS", "续费成功"),

+ 0 - 5
mec-education/pom.xml

@@ -24,11 +24,6 @@
 			<groupId>org.springframework.cloud</groupId>
 			<artifactId>spring-cloud-starter-security</artifactId>
 		</dependency>
-		<dependency>
-			<groupId>com.github.penggle</groupId>
-			<artifactId>kaptcha</artifactId>
-			<version>2.3.2</version>
-		</dependency>
 
 		<dependency>
 			<groupId>org.springframework.cloud</groupId>

+ 7 - 29
mec-education/src/main/java/com/ym/mec/education/controller/SmsCodeController.java

@@ -66,7 +66,7 @@ public class SmsCodeController extends BaseController {
         if(StringUtils.isEmpty(phone) || StringUtils.isEmpty(code)){
             return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
         }
-        String redisKey = Constants.KAPTCHA_SESSION_KEY + phone;
+        String redisKey = MessageTypeEnum.KAPTCHA_SESSION_KEY + phone;
         if(redisTemplate.hasKey(redisKey)){
             if(StringUtils.equalsIgnoreCase(redisTemplate.opsForValue().get(redisKey),code)){
                 return succeed();
@@ -75,37 +75,15 @@ public class SmsCodeController extends BaseController {
         return failed(SecurityConstants.VERIFY_FAILURE);
     }
 
-    @GetMapping(value = "/getLoginImage")
+    @RequestMapping("/getLoginImage")
     @ApiOperation("获取登录图片验证码")
     @ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String")
-    public void getKaptchaImage(HttpServletResponse response,String phone) throws Exception {
+    public void getLoginImage(HttpServletRequest request, HttpServletResponse response,String phone) throws Exception {
         if(StringUtils.isEmpty(phone)){
-            return;
-        }
-        response.setDateHeader("Expires", 0);
-
-        // Set standard HTTP/1.1 no-cache headers.
-        response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
-        // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
-        response.addHeader("Cache-Control", "post-check=0, pre-check=0");
-        // Set standard HTTP/1.0 no-cache header.
-        response.setHeader("Pragma", "no-cache");
-        // return a jpeg
-        response.setContentType("image/jpeg");
-        // create the text for the image
-        String capText = captchaProducer.createText();
-
-        redisTemplate.opsForValue().set(Constants.KAPTCHA_SESSION_KEY + phone,capText,3, TimeUnit.MINUTES);
-        // create the image with the text
-        BufferedImage bi = captchaProducer.createImage(capText);
-        KaptchaServlet kaptchaServlet = new KaptchaServlet();
-        kaptchaServlet.init();
-        ServletOutputStream out = response.getOutputStream();
-        try {
-            ImageIO.write(bi, "jpg", out);
-            out.flush();
-        } finally {
-            out.close();
+            throw new BizException("请输入手机号");
         }
+        SpecCaptcha specCaptcha = new SpecCaptcha(125, 45, 5);
+        redisTemplate.opsForValue().set(MessageTypeEnum.KAPTCHA_SESSION_KEY + phone,specCaptcha.text(),3, TimeUnit.MINUTES);
+        CaptchaUtil.out(specCaptcha, request, response);
     }
 }

+ 0 - 5
mec-student/pom.xml

@@ -48,11 +48,6 @@
 			<artifactId>mysql-connector-java</artifactId>
 		</dependency>
 		<dependency>
-			<groupId>com.github.penggle</groupId>
-			<artifactId>kaptcha</artifactId>
-			<version>2.3.2</version>
-		</dependency>
-		<dependency>
 			<groupId>com.github.whvcse</groupId>
 			<artifactId>easy-captcha</artifactId>
 			<version>1.6.2</version>

+ 0 - 28
mec-student/src/main/java/com/ym/mec/student/config/ImageVerifyCodeConfig.java

@@ -1,28 +0,0 @@
-package com.ym.mec.student.config;
-
-import com.google.code.kaptcha.impl.DefaultKaptcha;
-import com.google.code.kaptcha.util.Config;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.Properties;
-
-@Configuration
-public class ImageVerifyCodeConfig {
-    @Bean(name="captchaProducer")
-    public DefaultKaptcha getKaptchaBean(){
-        DefaultKaptcha defaultKaptcha=new DefaultKaptcha();
-        Properties properties=new Properties();
-        properties.setProperty("kaptcha.border", "yes");
-        properties.setProperty("kaptcha.border.color", "105,179,90");
-        properties.setProperty("kaptcha.textproducer.font.color", "blue");
-        properties.setProperty("kaptcha.image.width", "125");
-        properties.setProperty("kaptcha.image.height", "45");
-        properties.setProperty("kaptcha.session.key", "code");
-        properties.setProperty("kaptcha.textproducer.char.length", "4");
-        properties.setProperty("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑");
-        Config config=new Config(properties);
-        defaultKaptcha.setConfig(config);
-        return defaultKaptcha;
-    }
-}

+ 3 - 49
mec-student/src/main/java/com/ym/mec/student/controller/SmsCodeController.java

@@ -1,12 +1,8 @@
 package com.ym.mec.student.controller;
 
-import com.google.code.kaptcha.Constants;
-import com.google.code.kaptcha.Producer;
-import com.google.code.kaptcha.servlet.KaptchaServlet;
-import com.wf.captcha.GifCaptcha;
 import com.wf.captcha.SpecCaptcha;
 import com.wf.captcha.utils.CaptchaUtil;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.service.SmsCodeService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.exception.BizException;
@@ -18,16 +14,11 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-
-import javax.imageio.ImageIO;
-import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.awt.image.BufferedImage;
 import java.util.concurrent.TimeUnit;
 
 @RestController
@@ -38,8 +29,6 @@ public class SmsCodeController extends BaseController {
     @Autowired
     private SmsCodeService smsCodeService;
     @Autowired
-    private Producer captchaProducer;
-    @Autowired
     private RedisTemplate<String,String> redisTemplate;
 
     @ApiOperation(value = "发送登录短信验证码")
@@ -72,7 +61,7 @@ public class SmsCodeController extends BaseController {
         if(StringUtils.isEmpty(phone) || StringUtils.isEmpty(code)){
             return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
         }
-        String redisKey = Constants.KAPTCHA_SESSION_KEY + phone;
+        String redisKey = MessageTypeEnum.KAPTCHA_SESSION_KEY + phone;
         if(redisTemplate.hasKey(redisKey)){
             if(StringUtils.equalsIgnoreCase(redisTemplate.opsForValue().get(redisKey),code)){
                 return succeed();
@@ -89,42 +78,7 @@ public class SmsCodeController extends BaseController {
             throw new BizException("请输入手机号");
         }
         SpecCaptcha specCaptcha = new SpecCaptcha(125, 45, 5);
-        redisTemplate.opsForValue().set(Constants.KAPTCHA_SESSION_KEY + phone,specCaptcha.text(),3, TimeUnit.MINUTES);
+        redisTemplate.opsForValue().set(MessageTypeEnum.KAPTCHA_SESSION_KEY + phone,specCaptcha.text(),3, TimeUnit.MINUTES);
         CaptchaUtil.out(specCaptcha, request, response);
     }
-
-//    @GetMapping(value = "/getLoginImage")
-//    @ApiOperation("获取登录图片验证码")
-//    @ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String")
-//    public void getKaptchaImage(HttpServletResponse response,String phone) throws Exception {
-//        if(StringUtils.isEmpty(phone)){
-//            throw new BizException("请输入手机号");
-//        }
-//        response.setDateHeader("Expires", 0);
-//
-//        // Set standard HTTP/1.1 no-cache headers.
-//        response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
-//        // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
-//        response.addHeader("Cache-Control", "post-check=0, pre-check=0");
-//        // Set standard HTTP/1.0 no-cache header.
-//        response.setHeader("Pragma", "no-cache");
-//        // return a jpeg
-//        response.setContentType("image/jpeg");
-//        // create the text for the image
-//        String capText = captchaProducer.createText();
-//
-//        redisTemplate.opsForValue().set(Constants.KAPTCHA_SESSION_KEY + phone,capText,3, TimeUnit.MINUTES);
-//        // create the image with the text
-//        BufferedImage bi = captchaProducer.createImage(capText);
-//        KaptchaServlet kaptchaServlet = new KaptchaServlet();
-//        kaptchaServlet.init();
-//        ServletOutputStream out = response.getOutputStream();
-//        // write the data out
-//        try {
-//            ImageIO.write(bi, "jpg", out);
-//            out.flush();
-//        } finally {
-//            out.close();
-//        }
-//    }
 }

+ 5 - 5
mec-teacher/pom.xml

@@ -45,11 +45,6 @@
 			<groupId>com.alibaba</groupId>
 			<artifactId>druid-spring-boot-starter</artifactId>
 		</dependency>
-		<dependency>
-			<groupId>com.github.penggle</groupId>
-			<artifactId>kaptcha</artifactId>
-			<version>2.3.2</version>
-		</dependency>
 
 		<dependency>
 			<groupId>mysql</groupId>
@@ -65,6 +60,11 @@
 			<groupId>com.yonge.log</groupId>
 			<artifactId>audit-log</artifactId>
 		</dependency>
+		<dependency>
+			<groupId>com.github.whvcse</groupId>
+			<artifactId>easy-captcha</artifactId>
+			<version>1.6.2</version>
+		</dependency>
     </dependencies>
 	<build>
 		<plugins>

+ 0 - 28
mec-teacher/src/main/java/com/ym/mec/teacher/config/ImageVerifyCodeConfig.java

@@ -1,28 +0,0 @@
-package com.ym.mec.teacher.config;
-
-import com.google.code.kaptcha.impl.DefaultKaptcha;
-import com.google.code.kaptcha.util.Config;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.Properties;
-
-@Configuration
-public class ImageVerifyCodeConfig {
-    @Bean(name="captchaProducer")
-    public DefaultKaptcha getKaptchaBean(){
-        DefaultKaptcha defaultKaptcha=new DefaultKaptcha();
-        Properties properties=new Properties();
-        properties.setProperty("kaptcha.border", "yes");
-        properties.setProperty("kaptcha.border.color", "105,179,90");
-        properties.setProperty("kaptcha.textproducer.font.color", "blue");
-        properties.setProperty("kaptcha.image.width", "125");
-        properties.setProperty("kaptcha.image.height", "45");
-        properties.setProperty("kaptcha.session.key", "code");
-        properties.setProperty("kaptcha.textproducer.char.length", "4");
-        properties.setProperty("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑");
-        Config config=new Config(properties);
-        defaultKaptcha.setConfig(config);
-        return defaultKaptcha;
-    }
-}

+ 12 - 39
mec-teacher/src/main/java/com/ym/mec/teacher/controller/SmsCodeController.java

@@ -1,10 +1,11 @@
 package com.ym.mec.teacher.controller;
 
-import com.google.code.kaptcha.Constants;
-import com.google.code.kaptcha.Producer;
-import com.google.code.kaptcha.servlet.KaptchaServlet;
+import com.wf.captcha.SpecCaptcha;
+import com.wf.captcha.utils.CaptchaUtil;
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.service.SmsCodeService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.security.SecurityConstants;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -13,15 +14,11 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-
-import javax.imageio.ImageIO;
-import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.awt.image.BufferedImage;
 import java.util.concurrent.TimeUnit;
 
 @RestController
@@ -32,8 +29,6 @@ public class SmsCodeController extends BaseController {
     @Autowired
     private SmsCodeService smsCodeService;
     @Autowired
-    private Producer captchaProducer;
-    @Autowired
     private RedisTemplate<String,String> redisTemplate;
 
     @ApiOperation(value = "发送登录短信验证码")
@@ -66,7 +61,7 @@ public class SmsCodeController extends BaseController {
         if(StringUtils.isEmpty(phone) || StringUtils.isEmpty(code)){
             return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
         }
-        String redisKey = Constants.KAPTCHA_SESSION_KEY + phone;
+        String redisKey = MessageTypeEnum.KAPTCHA_SESSION_KEY + phone;
         if(redisTemplate.hasKey(redisKey)){
             if(StringUtils.equalsIgnoreCase(redisTemplate.opsForValue().get(redisKey),code)){
                 return succeed();
@@ -75,37 +70,15 @@ public class SmsCodeController extends BaseController {
         return failed(SecurityConstants.VERIFY_FAILURE);
     }
 
-    @GetMapping(value = "/getLoginImage")
+    @RequestMapping("/getLoginImage")
     @ApiOperation("获取登录图片验证码")
     @ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String")
-    public void getKaptchaImage(HttpServletResponse response,String phone) throws Exception {
+    public void getLoginImage(HttpServletRequest request, HttpServletResponse response, String phone) throws Exception {
         if(StringUtils.isEmpty(phone)){
-            return;
-        }
-        response.setDateHeader("Expires", 0);
-
-        // Set standard HTTP/1.1 no-cache headers.
-        response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
-        // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
-        response.addHeader("Cache-Control", "post-check=0, pre-check=0");
-        // Set standard HTTP/1.0 no-cache header.
-        response.setHeader("Pragma", "no-cache");
-        // return a jpeg
-        response.setContentType("image/jpeg");
-        // create the text for the image
-        String capText = captchaProducer.createText();
-
-        redisTemplate.opsForValue().set(Constants.KAPTCHA_SESSION_KEY + phone,capText,3, TimeUnit.MINUTES);
-        // create the image with the text
-        BufferedImage bi = captchaProducer.createImage(capText);
-        KaptchaServlet kaptchaServlet = new KaptchaServlet();
-        kaptchaServlet.init();
-        ServletOutputStream out = response.getOutputStream();
-        try {
-            ImageIO.write(bi, "jpg", out);
-            out.flush();
-        } finally {
-            out.close();
+            throw new BizException("请输入手机号");
         }
+        SpecCaptcha specCaptcha = new SpecCaptcha(125, 45, 5);
+        redisTemplate.opsForValue().set(MessageTypeEnum.KAPTCHA_SESSION_KEY + phone,specCaptcha.text(),3, TimeUnit.MINUTES);
+        CaptchaUtil.out(specCaptcha, request, response);
     }
 }

+ 3 - 4
mec-web/pom.xml

@@ -61,11 +61,10 @@
 			<groupId>com.yonge.log</groupId>
 			<artifactId>audit-log</artifactId>
 		</dependency>
-		
 		<dependency>
-			<groupId>com.github.penggle</groupId>
-			<artifactId>kaptcha</artifactId>
-			<version>2.3.2</version>
+			<groupId>com.github.whvcse</groupId>
+			<artifactId>easy-captcha</artifactId>
+			<version>1.6.2</version>
 		</dependency>
 
 	</dependencies>

+ 0 - 28
mec-web/src/main/java/com/ym/mec/web/config/ImageVerifyCodeConfig.java

@@ -1,28 +0,0 @@
-package com.ym.mec.web.config;
-
-import com.google.code.kaptcha.impl.DefaultKaptcha;
-import com.google.code.kaptcha.util.Config;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.Properties;
-
-@Configuration
-public class ImageVerifyCodeConfig {
-    @Bean(name="captchaProducer")
-    public DefaultKaptcha getKaptchaBean(){
-        DefaultKaptcha defaultKaptcha=new DefaultKaptcha();
-        Properties properties=new Properties();
-        properties.setProperty("kaptcha.border", "yes");
-        properties.setProperty("kaptcha.border.color", "105,179,90");
-        properties.setProperty("kaptcha.textproducer.font.color", "blue");
-        properties.setProperty("kaptcha.image.width", "125");
-        properties.setProperty("kaptcha.image.height", "45");
-        properties.setProperty("kaptcha.session.key", "code");
-        properties.setProperty("kaptcha.textproducer.char.length", "4");
-        properties.setProperty("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑");
-        Config config=new Config(properties);
-        defaultKaptcha.setConfig(config);
-        return defaultKaptcha;
-    }
-}

+ 12 - 39
mec-web/src/main/java/com/ym/mec/web/controller/SmsCodeController.java

@@ -1,10 +1,11 @@
 package com.ym.mec.web.controller;
 
-import com.google.code.kaptcha.Constants;
-import com.google.code.kaptcha.Producer;
-import com.google.code.kaptcha.servlet.KaptchaServlet;
+import com.wf.captcha.SpecCaptcha;
+import com.wf.captcha.utils.CaptchaUtil;
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.service.SmsCodeService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.security.SecurityConstants;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -13,15 +14,11 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-
-import javax.imageio.ImageIO;
-import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.awt.image.BufferedImage;
 import java.util.concurrent.TimeUnit;
 
 @RestController
@@ -32,8 +29,6 @@ public class SmsCodeController extends BaseController {
     @Autowired
     private SmsCodeService smsCodeService;
     @Autowired
-    private Producer captchaProducer;
-    @Autowired
     private RedisTemplate<String,String> redisTemplate;
 
     @ApiOperation(value = "发送登录短信验证码")
@@ -66,7 +61,7 @@ public class SmsCodeController extends BaseController {
         if(StringUtils.isEmpty(phone) || StringUtils.isEmpty(code)){
             return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
         }
-        String redisKey = Constants.KAPTCHA_SESSION_KEY + phone;
+        String redisKey = MessageTypeEnum.KAPTCHA_SESSION_KEY + phone;
         if(redisTemplate.hasKey(redisKey)){
             if(StringUtils.equalsIgnoreCase(redisTemplate.opsForValue().get(redisKey),code)){
                 return succeed();
@@ -75,37 +70,15 @@ public class SmsCodeController extends BaseController {
         return failed(SecurityConstants.VERIFY_FAILURE);
     }
 
-    @GetMapping(value = "/getLoginImage")
+    @RequestMapping("/getLoginImage")
     @ApiOperation("获取登录图片验证码")
     @ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String")
-    public void getKaptchaImage(HttpServletResponse response, String phone) throws Exception {
+    public void getLoginImage(HttpServletRequest request, HttpServletResponse response, String phone) throws Exception {
         if(StringUtils.isEmpty(phone)){
-            return;
-        }
-        response.setDateHeader("Expires", 0);
-
-        // Set standard HTTP/1.1 no-cache headers.
-        response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
-        // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
-        response.addHeader("Cache-Control", "post-check=0, pre-check=0");
-        // Set standard HTTP/1.0 no-cache header.
-        response.setHeader("Pragma", "no-cache");
-        // return a jpeg
-        response.setContentType("image/jpeg");
-        // create the text for the image
-        String capText = captchaProducer.createText();
-
-        redisTemplate.opsForValue().set(Constants.KAPTCHA_SESSION_KEY + phone,capText,3, TimeUnit.MINUTES);
-        // create the image with the text
-        BufferedImage bi = captchaProducer.createImage(capText);
-        KaptchaServlet kaptchaServlet = new KaptchaServlet();
-        kaptchaServlet.init();
-        ServletOutputStream out = response.getOutputStream();
-        try {
-            ImageIO.write(bi, "jpg", out);
-            out.flush();
-        } finally {
-            out.close();
+            throw new BizException("请输入手机号");
         }
+        SpecCaptcha specCaptcha = new SpecCaptcha(125, 45, 5);
+        redisTemplate.opsForValue().set(MessageTypeEnum.KAPTCHA_SESSION_KEY + phone,specCaptcha.text(),3, TimeUnit.MINUTES);
+        CaptchaUtil.out(specCaptcha, request, response);
     }
 }