コード例 #1
0
  public String getEmailPass() {
    logger.info("11111___________");
    String mothed = ServletActionContext.getRequest().getMethod();
    if (!"post".equalsIgnoreCase(mothed)) {
      return "sessionDestory";
    }
    String usAccount = ServletActionContext.getRequest().getParameter("usAccount");
    String validatecode = ServletActionContext.getRequest().getParameter("validatecode");
    if (usAccount == null || validatecode == null) {
      ServletActionContext.getRequest().setAttribute("checkFlag", "1");
      return "email";
    }

    String validateCode =
        (String) ActionContext.getContext().getSession().get(Constants.VALIDATE_RECOVER_CODE_EMAIL);
    if (!validatecode.equalsIgnoreCase(validateCode)) {
      ServletActionContext.getRequest().setAttribute("checkFlag", "2");
      return "email";
    }

    if (!iAccountInfo.isNotExistAccountName(usAccount)) {
      String count = iPassRecover.getPassRecoverCountToday(usAccount, "2");
      if (Long.valueOf(count) >= 3) {
        ServletActionContext.getRequest().setAttribute("checkFlag", "3");
        return "email";
      }
      AuctionAccount auctionAccount = iAccountInfo.getAccountInfoByAccountName(usAccount);
      if ("0".equals(auctionAccount.getAccountStatus())) {
        ServletActionContext.getRequest().setAttribute("checkFlag", "4");
        return "email";
      } else if ("2".equals(auctionAccount.getAccountStatus())) {
        ServletActionContext.getRequest().setAttribute("checkFlag", "5");
        return "email";
      } else if ("1".equals(auctionAccount.getAccountStatus())) {
        AuctionGuest auctionGuest = iGuestInfo.getGuestInfo(auctionAccount.getAccountRelationId());

        String randStr = RandomStringUtils.random(6, true, true).toLowerCase();

        PassRecover passRecover = new PassRecover();
        passRecover.setId(null);
        passRecover.setAccountName(usAccount);
        passRecover.setCreateTime(new Date());
        passRecover.setAccountPassType("2");
        passRecover.setAccountPassTemp(randStr);
        iPassRecover.savePassRecover(passRecover);

        MailSender.sendPassMessage(
            auctionGuest.getGuestEmail(), auctionGuest.getGuestName(), randStr);
        ServletActionContext.getRequest().setAttribute("checkFlag", "6");
        return "email";
      } else {
        ServletActionContext.getRequest().setAttribute("checkFlag", "1");
        return "email";
      }
    } else {
      ServletActionContext.getRequest().setAttribute("checkFlag", "1");
      return "email";
    }
  }
コード例 #2
0
  public String getPhonePass() {
    logger.info("11111___________");
    String mothed = ServletActionContext.getRequest().getMethod();
    if (!"post".equalsIgnoreCase(mothed)) {
      return "sessionDestory";
    }
    String usAccount = ServletActionContext.getRequest().getParameter("usAccount");
    String validatecode = ServletActionContext.getRequest().getParameter("validatecode");
    if (usAccount == null || validatecode == null) {
      ServletActionContext.getRequest().setAttribute("checkFlag", "1");
      return "phone";
    }

    String validateCode =
        (String) ActionContext.getContext().getSession().get(Constants.VALIDATE_RECOVER_CODE_PHONE);
    if (!validatecode.equalsIgnoreCase(validateCode)) {
      ServletActionContext.getRequest().setAttribute("checkFlag", "2");
      return "phone";
    }

    if (!iAccountInfo.isNotExistAccountName(usAccount)) {
      String count = iPassRecover.getPassRecoverCountToday(usAccount, "1");
      if (Long.valueOf(count) >= 3) {
        ServletActionContext.getRequest().setAttribute("checkFlag", "3");
        return "phone";
      }
      AuctionAccount auctionAccount = iAccountInfo.getAccountInfoByAccountName(usAccount);
      if ("0".equals(auctionAccount.getAccountStatus())) {
        ServletActionContext.getRequest().setAttribute("checkFlag", "4");
        return "phone";
      } else if ("2".equals(auctionAccount.getAccountStatus())) {
        ServletActionContext.getRequest().setAttribute("checkFlag", "5");
        return "phone";
      } else if ("1".equals(auctionAccount.getAccountStatus())) {
        AuctionGuest auctionGuest = iGuestInfo.getGuestInfo(auctionAccount.getAccountRelationId());

        String randStr = RandomStringUtils.random(6, true, true).toLowerCase();

        PassRecover passRecover = new PassRecover();
        passRecover.setId(null);
        passRecover.setAccountName(usAccount);
        passRecover.setCreateTime(new Date());
        passRecover.setAccountPassType("1");
        passRecover.setAccountPassTemp(randStr);
        iPassRecover.savePassRecover(passRecover);

        StringBuffer mms = new StringBuffer();
        mms.append("网络拍卖信息系统随机短信密码:");
        mms.append(randStr);
        mms.append(" ,此密码为短信登陆密码。");
        try {
          SmsSender.SendSms(auctionGuest.getGuestPhone(), mms.toString());
        } catch (UnsupportedEncodingException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        ServletActionContext.getRequest().setAttribute("checkFlag", "6");
        return "phone";
      } else {
        ServletActionContext.getRequest().setAttribute("checkFlag", "1");
        return "phone";
      }
    } else {
      ServletActionContext.getRequest().setAttribute("checkFlag", "1");
      return "phone";
    }
  }