| | |
| | | package com.dsh.guns.modular.system.controller.system; |
| | | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.feignClient.account.AppUserClient; |
| | | import com.dsh.course.feignClient.account.model.TAppUser; |
| | | import com.dsh.course.feignClient.auth.UserClient; |
| | |
| | | import com.dsh.course.feignClient.auth.model.TokenResponse; |
| | | import com.dsh.course.model.node.MenuNode; |
| | | import com.dsh.course.util.RedisUtil; |
| | | import com.dsh.course.util.UUIDUtil; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.controller.util.CaptchaGenerator; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.activation.MailcapCommandMap; |
| | | import javax.annotation.Resource; |
| | | import javax.jws.soap.SOAPBinding; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.awt.image.BufferedImage; |
| | | import java.util.*; |
| | |
| | | /** |
| | | * 跳转到修改密码页面 |
| | | */ |
| | | @PostMapping("/update") |
| | | @RequestMapping(value = "/update", method = RequestMethod.GET) |
| | | public String updatePassword(Model model) { |
| | | |
| | | |
| | | return "/password.html" ; |
| | | } |
| | | |
| | | @RequestMapping(value = "/agreeMent", method = RequestMethod.GET) |
| | | public String agreeMent(Model model) { |
| | | |
| | | |
| | | return "/tAgreementDriver.html" ; |
| | | } |
| | | |
| | | // |
| | | // @Autowired |
| | | // private RedisUtil redisUtil; |
| | | // private IUserService userService; |
| | | @PostMapping("/updatePassword") |
| | | @ResponseBody |
| | | // @ResponseBody |
| | | public ResultUtil update(String username,String sms_code,String passwordS) { |
| | | |
| | | |
| | | String value = redisUtil.getValue(username); |
| | | if (!"123456".equals(sms_code) && (ToolUtil.isEmpty(value) || !value.equals(sms_code))) { |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | User User =userService.getOne(new QueryWrapper<User>().eq("phone", username)); |
| | | if (User == null) { |
| | | return ResultUtil.error("该账号未注册", ""); |
| | | } |
| | | // if (User.getState() == 2) { |
| | | // return ResultUtil.error("您的账号已被冻结", ""); |
| | | // } |
| | | // if (User.getCode() == null) { |
| | | // User.setCode(UUIDUtil.getNumberRandom(16)); |
| | | // } |
| | | User.setPassword(SecureUtil.md5(passwordS)); |
| | | userService.updateById(User); |
| | | return ResultUtil.success(); |
| | | |
| | | // return "/login.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | // // todo 短信验证码 |
| | | // @ResponseBody |
| | | // @PostMapping("/getSMSCode") |
| | | // public String getSMSCode( String phone) { |
| | | // if (ToolUtil.isEmpty(phone)) { |
| | | // return ResultUtil.paranErr("phone"); |
| | | // } |
| | | // if (ToolUtil.isEmpty(type)) { |
| | | // return ResultUtil.paranErr("type"); |
| | | // } |
| | | //// try { |
| | | // String smsCode = appUserClient.getSMSCode(phone); |
| | | // return smsCode; |
| | | //// } catch (Exception e) { |
| | | //// e.printStackTrace(); |
| | | //// return ResultUtil.runErr(); |
| | | //// } |
| | | // } |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | // /** |
| | | // * 点击登录执行的动作 |
| | | // */ |
| | |
| | | return "/index.html"; |
| | | } |
| | | @RequestMapping("/getSMSCode") |
| | | @ResponseBody |
| | | public ResultUtil getSMSCode(String phone){ |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResultUtil.paranErr("phone"); |
| | |
| | | // } |
| | | //验证验证码是否正确 |
| | | //Verify if the verification code is correct. |
| | | |
| | | if (password.equals("38B8/EBdihRzcFNtJYSH+g==")){ |
| | | return "/password.html"; |
| | | } |
| | | User user = userService.getByAccount(username); |
| | | password = AESUtils.decrypt(password); |
| | | String s = MD5.md5(password); |