Beispiel #1
0
 @Action(
     value = "validatePwd",
     results = {
       @Result(
           type = "json",
           params = {"root", "entityMap", "contentType", "text/html"})
     })
 public String validatePwd() {
   try {
     // 从session里取出当前登录用户的密码;
     String userAccount = users.getAccount(); // get value from session
     // 页面输入的原密码
     String pagePwd = request.getParameter("pwd");
     // 用登录账号加密
     pagePwd = new MasPasswordTool().getEncString(pagePwd, userAccount);
     portalUser = new UserVO();
     portalUser.setAccount(userAccount);
     Users user = userService.validateUser(portalUser);
     if (user.getPassword().equals(pagePwd)) {
       entityMap.put("flag", "success");
     } else {
       entityMap.put("flag", "error");
     }
     logger.info("validatePWD: entityMap->" + entityMap);
   } catch (Exception e) {
     logger.error("validate password error", e);
   }
   return SUCCESS;
 }
Beispiel #2
0
  /**
   * 设置短信验证码
   *
   * @return
   */
  @Action(
      value = "smsCheckSetting",
      results = {
        @Result(
            type = "json",
            params = {"root", "entityMap", "contentType", "text/html"})
      })
  public String smsCheckSetting() {
    try {
      entityMap = new HashMap<String, Object>();
      String smsCheckServer =
          (String)
              getSession()
                  .getAttribute(
                      ApSmsConstants
                          .SESSION_SMS_CHECKING_NUMBER); // .get(ApSmsConstants.SESSION_SMS_CHECKING_NUMBER);
      if (!smsCheckServer.equalsIgnoreCase(smsCheckContent)) {
        entityMap.put("flag", false);
        entityMap.put("resultMsg", "短信验证码错误!");
        return SUCCESS;
      }
      //			UserVO sessionUser = (UserVO)
      // getSession().getAttribute(ApSmsConstants.SESSION_USER_INFO);
      if (!users
          .getPassword()
          .equalsIgnoreCase(MasPasswordTool.getEncString(userPsw, users.getAccount()))) {
        entityMap.put("flag", false);
        entityMap.put("resultMsg", "管理员密码错误!");
        return SUCCESS;
      }
      PortalUserExtBean tempUserExt = portalUserExtService.getByPk(portalUserExt.getId());
      tempUserExt.setSmsMobile(portalUserExt.getSmsMobile());
      portalUserExtService.update(tempUserExt);
      ActionContext.getContext().getSession().remove(ApSmsConstants.SESSION_SMS_CHECKING_NUMBER);
      // 地市管理员更新企业管理员,需要同步至业务节点 20130926
      if (users.getUserType() == ApSmsConstants.USER_TYPE_CITY_ADMIN) {
        try {
          updateUserExtToNode(portalUser, tempUserExt);
        } catch (Exception e) {
          logger.error("Add sms mobile to node faile", e);
        }
      }
      entityMap.put("flag", true);
      entityMap.put("resultMsg", "短信验证码绑定成功!");
    } catch (Exception e) {
      logger.error("delete user error", e);
    }

    return SUCCESS;
  }
Beispiel #3
0
 /**
  * 修改密码
  *
  * @return
  */
 @Action(
     value = "updatePwdFirst",
     results = {
       @Result(
           type = "json",
           params = {"root", "entityMap", "contentType", "text/html"})
     })
 public String updatePwdFirst() {
   try {
     // 从session里取出当前登录用户的密码;
     Long userId = (Long) ActionContext.getContext().getSession().get("pwd_security_policy");
     Users user = userService.queryByUserId(userId);
     String pagePwd = request.getParameter("pwd");
     pagePwd = new MasPasswordTool().getEncString(pagePwd, user.getAccount());
     if (!pagePwd.equals(user.getPassword())) {
       entityMap.put("flag", "error");
       entityMap.put("message", "原密码错误!");
     } else {
       UserVO uservo = new UserVO();
       uservo.setId(userId);
       uservo.setFirstLoginFlag(1);
       uservo.setUpdateTime(new Date());
       uservo.setAccount(user.getAccount());
       uservo.setPassword(portalUser.getPassword());
       logger.info("update pwd: " + uservo);
       userService.updatePwd(uservo);
       entityMap.put("flag", "success");
       entityMap.put("message", "密码修改成功!请重新登录系统!");
     }
     logger.info("validatePWD: entityMap->" + entityMap);
   } catch (Exception e) {
     logger.error("validate password error", e);
     entityMap.put("flag", "error");
     entityMap.put("message", "密码修改失败,请联系管理员");
   }
   return SUCCESS;
 }