| | |
| | | @PostMapping(value = "/login", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<TokenEntity> login(@RequestBody UserEntity user, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | String str = userService.validateNewPwd(user); |
| | | String str = userService.validateLoginPwd(user); |
| | | if (str != null) { |
| | | return fail(str, null); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 验证登录用户密码 |
| | | */ |
| | | public String validateLoginPwd(UserEntity entity) { |
| | | try { |
| | | String str = validateUserEntity(entity); |
| | | if (str != null) { |
| | | return str; |
| | | } |
| | | |
| | | // 解密 |
| | | String uid = RsaHelper.decrypt(entity.getUid()); |
| | | String pwd = RsaHelper.decrypt(entity.getPwd()); |
| | | |
| | | entity.setUid(uid); |
| | | entity.setPwd(pwd); |
| | | |
| | | return null; |
| | | } catch (Exception ex) { |
| | | return "密码解密失败"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验证新用户密码 |
| | | */ |
| | | public String validateNewPwd(UserEntity entity) { |