예제 #1
0
  /**
   * @param oldpwd
   * @param newpwd
   * @param request
   * @return @Description:重置密码
   */
  @ResponseBody
  @RequestMapping("/rePassword")
  public String rePassword(String oldpwd, String newpwd, HttpServletRequest request) {
    SimpleReturnVo vo;
    User user = WebUtils.getLoginUser(request);
    String password = MD5Util.getMD5String(PrivilegeConstant.USER_PASSWORD_FRONT + oldpwd);
    if (!password.equals(user.getPassword())) {
      vo = new SimpleReturnVo(this.FAIL, "原密码不正确!");
      return JsonUtils.toJson(vo);
    }
    try {
      User newUser = new User();
      newUser.setId(user.getId());
      password = MD5Util.getMD5String(PrivilegeConstant.USER_PASSWORD_FRONT + newpwd);
      newUser.setPassword(password);
      this.userService.singleUpdateUser(newUser);
      vo = new SimpleReturnVo(this.SUCCESS, "成功");
    } catch (Exception e) {
      e.printStackTrace();
      logger.debug("UserController-rePassword:"******"异常错误!");
    }

    return JsonUtils.toJson(vo);
  }
예제 #2
0
 /**
  * @param request
  * @return @Description:修改密码
  */
 @ResponseBody
 @RequestMapping("/updatePassowrd")
 public String updatePassowrd(User user) {
   SimpleReturnVo vo;
   String password =
       MD5Util.getMD5String(PrivilegeConstant.USER_PASSWORD_FRONT + user.getPassword());
   try {
     user.setPassword(password);
     this.userService.singleUpdateUser(user);
     vo = new SimpleReturnVo(this.SUCCESS, "成功");
   } catch (Exception e) {
     e.printStackTrace();
     logger.debug("UserController-updatePassowrd:" + e.getMessage());
     vo = new SimpleReturnVo(this.FAIL, "异常错误!");
   }
   return JsonUtils.toJson(vo);
 }
예제 #3
0
 @Override
 public void insertUser(User user) throws Exception {
   user.setId(UUIDGenerator.generate());
   user.setPassword("888888");
   userDao.insertUser(user);
   String systemIds = user.getSystemIds();
   if (StringUtils.isNotBlank(systemIds)) {
     String[] syses = systemIds.split(",");
     for (String sys : syses) {
       UserSystem userSystem = new UserSystem();
       userSystem.setSystemId(sys);
       userSystem.setId(UUIDGenerator.generate());
       userSystem.setUserId(user.getId());
       this.userSystemDao.insertUserSystem(userSystem);
     }
   }
 }