| | |
| | | import javax.annotation.Resource; |
| | | import javax.jws.soap.SOAPBinding; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.awt.image.BufferedImage; |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | return "/password.html" ; |
| | | } |
| | | |
| | | @RequestMapping(value = "/agreeMent", method = RequestMethod.GET) |
| | | public String agreeMent(Model model) { |
| | | |
| | | |
| | | return "/tAgreementDriver.html" ; |
| | | } |
| | | |
| | | // |
| | | // @Autowired |
| | | // private IUserService userService; |
| | |
| | | |
| | | |
| | | |
| | | // // todo 短信验证码 |
| | | // @ResponseBody |
| | | // @PostMapping("/getSMSCode") |
| | | // public String getSMSCode( String phone) { |
| | |
| | | if(null == user){ |
| | | return "/login.html"; |
| | | } |
| | | List<String> roleList = Arrays.asList(user.getRoleid().split(",")); |
| | | if (roleList == null || roleList.size() == 0) { |
| | | model.addAttribute("tips", "该用户没有角色,无法登陆"); |
| | | List<String> roleList = new ArrayList<>(); |
| | | if (user.getRoleid() != null) { |
| | | for (String roleId : user.getRoleid().split(",")) { |
| | | String trimmedRoleId = roleId.trim(); |
| | | if (trimmedRoleId.matches("\\d+")) { |
| | | try { |
| | | Integer.valueOf(trimmedRoleId); |
| | | roleList.add(trimmedRoleId); |
| | | } catch (NumberFormatException ignored) { |
| | | // 跳过超出 Integer 范围的脏角色数据。 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (roleList.isEmpty()) { |
| | | model.addAttribute("tips", "该用户没有有效角色,无法登录"); |
| | | return "/login.html"; |
| | | } |
| | | Integer language = UserExt.getLanguage(); |
| | | List<MenuNode> menus = menuService.getMenusByRoleIds(roleList); |
| | | List<MenuNode> titles = MenuNode.buildTitle(menus); |
| | | |
| | | List<String> resUrlsByRoleId = menuService.getResUrlsByRoleId(Integer.valueOf(roleList.get(0))); |
| | | Integer primaryRoleId = Integer.valueOf(roleList.get(0)); |
| | | List<String> resUrlsByRoleId = menuService.getResUrlsByRoleId(primaryRoleId); |
| | | CacheUtil.menus.put(user.getAccount(), resUrlsByRoleId); |
| | | |
| | | if (SinataUtil.isEmpty(user)){ |
| | |
| | | |
| | | model.addAttribute("titles", titles); |
| | | |
| | | Role role = roleService.getBaseMapper().selectById(roleList.get(0)); |
| | | Role role = roleService.getBaseMapper().selectById(primaryRoleId); |
| | | if (role == null) { |
| | | model.addAttribute("tips", "该用户角色不存在,无法登录"); |
| | | return "/login.html"; |
| | | } |
| | | |
| | | User byId = userService.getById(user.getId()); |
| | | //获取用户头像 Obtain user profile |
| | |
| | | if (password.equals("38B8/EBdihRzcFNtJYSH+g==")){ |
| | | return "/password.html"; |
| | | } |
| | | |
| | | //验证验证码是否正确 |
| | | String kaptcha = super.getPara("kaptcha").trim(); |
| | | String code = (String) super.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY); |
| | | if (ToolUtil.isEmpty(kaptcha) || !kaptcha.equalsIgnoreCase(code)) { |
| | | throw new InvalidKaptchaException(); |
| | | } |
| | | |
| | | User user = userService.getByAccount(username); |
| | | password = AESUtils.decrypt(password); |
| | | String s = MD5.md5(password); |
| | |
| | | return "/login.html"; |
| | | } |
| | | |
| | | |
| | | GetTokenRequest tokenRequest = new GetTokenRequest(); |
| | | tokenRequest.setUsername(username); |
| | | tokenRequest.setPassword(password); |
| | |
| | | super.getSession().setAttribute("language",language); |
| | | return REDIRECT + "/"; |
| | | } |
| | | |
| | | /** |
| | | * 退出登录 |
| | | */ |
| | |
| | | deleteAllCookie(); |
| | | return REDIRECT + "/login"; |
| | | } |
| | | |
| | | } |