700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > layui发送短信验证码 (二)后台接收及校验

layui发送短信验证码 (二)后台接收及校验

时间:2019-07-22 10:59:59

相关推荐

layui发送短信验证码 (二)后台接收及校验

//发送短信@RequestMapping(value = "/sendCode", method = RequestMethod.GET)@ResponseBodypublic void sendCode( String cellphone, String uuid,String vercode, HttpServletRequest request) {String code = (String) WebUtils.getSessionAttribute(request, AdminConstant.LOGIN_CAPTCHA);if (!code.toLowerCase().equals(vercode.toLowerCase())) {fail(StateCode.VCODE_ERROR);return;}String s = String.valueOf((int) (Math.random() * 9000) + 1000);smsService.sendCode(cellphone, s);captchaCloudManager.setMobile(uuid, cellphone, s);success();}//校验短信@RequestMapping(value = "/checkCode", method = RequestMethod.GET)@ResponseBodypublic void checkCode( String cellphone, String uuid,String smscode) {JSONObject json = new JSONObject();String mobileCode = captchaCloudManager.getMobile(uuid, cellphone);if (smscode.equalsIgnoreCase(mobileCode)){json.put("request",true);}else {json.put("request",false);}success(json);}//修改密码@RequestMapping(value = "/resPassword", method = RequestMethod.GET)@ResponseBodypublic void resPassword( String password, String repass,String mobile) {JSONObject json = new JSONObject();if (password.equalsIgnoreCase(repass)){AuthorUser user = authorUserManager.findByPhone(mobile);user.setPassword(MD5.md5(AdminConstant.PASSWORD_PREFIX+password+AdminConstant.PASSWORD_SUFFIX));authorUserManager.update(user);}else {json.put("request",false);}success(json);}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。