验证码输入正确却显示
来源: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
同学好,同学可以设置断点调试一下,看看到后台的时候,最终传入的预期验证码和实际验证码是多少
00
相似问题