验证码输入正确却显示

来源:6-4 店铺信息编辑之前端实现

三岁小绵阳

2019-01-03

图片描述
![public class CodeUtil { /** * 检查验证码是否和预期相符 * * @param request * @return */ public static boolean checkVerifyCode(HttpServletRequest request) { String verifyCodeExpected = (String) request.getSession() .getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY); String verifyCodeActual = HttpServletRequestUtil.getString(request, "verifyCodeActual"); if (verifyCodeActual == null || !verifyCodeActual.equals(verifyCodeExpected)) { return false; } return true; } }@RequestMapping(value = “/registershop”, method = RequestMethod.POST)
@ResponseBody
private Map<String, Object> registShop(HttpServletRequest request) {
Map<String, Object> modelMap = new HashMap<String, Object>();
if (!CodeUtil.checkVerifyCode(request)) {
modelMap.put(“success”, false);
modelMap.put(“errMsg”, “输入了错误的验证码”);
return modelMap;
}](

写回答

1回答

翔仔

2019-01-04

同学好,同学可以设置断点调试一下,看看到后台的时候,最终传入的预期验证码和实际验证码是多少

0
0

Java双版本(SSM到SpringBoot)校园商铺全栈开发

SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需

5113 学习 · 8144 问题

查看课程