Пример #1
0
  /**
   * Method to validate login credentials and to redirect to corresponding pages.
   *
   * @return void
   */
  public void logInAction() {
    final String METHOD_NAME = "logInAction()";
    logger.entering(CLASS_NAME, METHOD_NAME);

    initializeAllScreenMessages();
    getScreenDisplayData().setError(false);
    getScreenDisplayData().getMessage().setScreenResponseMessageForUser("");
    getScreenDisplayData().setUserEmailId(getScreenDisplayData().getUserEmailId().toUpperCase());

    if (StringValidator.isBlankOrNull(getScreenDisplayData().getUserEmailId())) {
      logger.debug("UserId is Blank");
      getScreenDisplayData().setError(true);
      getScreenDisplayData()
          .getMessage()
          .setScreenResponseMessageForUser(
              ErrorMessages.INVALID_USER_ID_OR_INVALID_PASSWORD_MESSAGE);
      commonErrorRendering();
    }

    if (StringValidator.isBlankOrNull(getScreenDisplayData().getUserPassword())) {
      logger.debug("Password is Blank");
      getScreenDisplayData().setError(true);
      getScreenDisplayData()
          .getMessage()
          .setScreenResponseMessageForUser(
              ErrorMessages.INVALID_USER_ID_OR_INVALID_PASSWORD_MESSAGE);
      commonErrorRendering();
    }

    if (getScreenDisplayData().isError() == true) {
      logger.debug("Error: UserID & PassWord is Blanck ");
    } else {
      validateUser(
          getScreenDisplayData().getUserEmailId(), getScreenDisplayData().getUserPassword());
    }

    logger.exiting(CLASS_NAME, METHOD_NAME);
  }
Пример #2
0
  /**
   * This Method Invokes when user forgot UserId Or PassWord, This Method send userId Or PassWord to
   * entered valid Email Address
   *
   * @param String infoNeeded
   * @return void
   */
  public void forgotIdPasswordAction(String infoNeeded) {
    final String METHOD_NAME = "forgotIdPasswordAction()";
    logger.entering(CLASS_NAME, METHOD_NAME);
    initializeAllScreenMessages();
    setTextMsg("");
    getScreenDisplayData().getMessage().setScreenResponseMessageForUser(null);
    getScreenDisplayData().setError(false);
    String tmpEmailId = getEmailToBeUsed(infoNeeded);

    if (infoNeeded.equals("userId")) {
      if (StringValidator.isBlankOrNull(getScreenDisplayData().getUserIdEmailAddress())) {
        logger.debug("Email Address is blanck or null");
        getScreenDisplayData()
            .getMessage()
            .setScreenResponseMessageForUser(
                MessageConstants.ERROR_USER_EMAIL_ADDRESS_BLANK_OR_INVALID);
        commonErrorRendering();
      } else {
        if (EmailUtil.isValidEmailAddress(tmpEmailId)) {
          boolean isSuccess = new MaintainUserBD().checkIfEmailAddressExist(tmpEmailId);
          if (isSuccess == true) {
            logger.debug("Email Address is Valid");
            EmailUtil.sendEmail(
                ("User Id: " + getScreenDisplayData().getUserEmailId()),
                tmpEmailId,
                ErrorMessages.FORGOT_LOGIN_CREDENTIAL_SUBJECT);
            getScreenDisplayData()
                .getMessage()
                .setScreenResponseMessageForUser(ErrorMessages.USER_ID_SENT_TO_EMAIL);
            getScreenDisplayData()
                .getMessage()
                .setScreenResponseMessageColor(ApplicationConstants.SUCCESS_MESSAGE_COLOR);
            getRenderer().getDataRenderer().setUserTextRenderer(true);

          } else {
            logger.debug("Email Address is not Valid");
            getScreenDisplayData()
                .getMessage()
                .setScreenResponseMessageForUser(ErrorMessages.CONTACT_US_INVALID_EMAIL_ADDRESS);
            commonErrorRendering();
          }
        } else {
          logger.debug("Invalid Email Address");
          getScreenDisplayData()
              .getMessage()
              .setScreenResponseMessageForUser(ErrorMessages.INVALID_EMAIL_ADDRESS_FORMAT);
          commonErrorRendering();
        }
      }
    } else if (infoNeeded.equals("password")) {
      if (StringValidator.isBlankOrNull(getScreenDisplayData().getPasswordEmailAddress())) {
        logger.debug("Email Address is blanck or null");
        getScreenDisplayData().setError(true);
        textScreenMsg(MessageConstants.ERROR_USER_EMAIL_ADDRESS_BLANK_OR_INVALID);
        getScreenDisplayData().getMessage().setScreenResponseMessageForUser(getTextMsg());
        commonErrorRendering();
      }

      if (StringValidator.isBlankOrNull(getScreenDisplayData().getPassCheckUserId())) {
        logger.debug("Email Address is blanck or null");
        getScreenDisplayData().setError(true);
        textScreenMsg(MessageConstants.ERROR_USER_PASWWORD_BLANK_OR_INVALID);
        getScreenDisplayData().getMessage().setScreenResponseMessageForUser(getTextMsg());
        commonErrorRendering();
      }

      if (getScreenDisplayData().isError() == true) {

      } else {
        if (EmailUtil.isValidEmailAddress(tmpEmailId)) {
          logger.debug("valid Email Address");
        } else {
          getScreenDisplayData().setError(true);
          logger.debug("Invalid Email Address");
          getScreenDisplayData()
              .getMessage()
              .setScreenResponseMessageForUser(ErrorMessages.INVALID_EMAIL_ADDRESS_FORMAT);
          commonErrorRendering();
        }

        UserDetailBO userDetailBOObject =
            new MaintainUserBD().fetchUserByEmailId(getScreenDisplayData().getPassCheckUserId());

        if (userDetailBOObject.getUserEmailId().equals("")
            || userDetailBOObject.getUserEmailId().equals(null)) {
          logger.debug("Entered userID does not exists");
          getScreenDisplayData().setError(true);
          getScreenDisplayData()
              .getMessage()
              .setScreenResponseMessageForUser(ErrorMessages.INVALID_USER_ID_MESSAGE);
          commonErrorRendering();
        }
        if (getScreenDisplayData().isError() == true) {
          logger.debug("Email Address & UserId are Not Correct");
        } else {
          if (tmpEmailId.equals(userDetailBOObject.getUserId())) {
            logger.debug("Valid Email Address:");
            EmailUtil.sendEmail(
                ("User Id: " + getScreenDisplayData().getPassCheckUserId()),
                tmpEmailId,
                ErrorMessages.FORGOT_LOGIN_CREDENTIAL_SUBJECT);
            getScreenDisplayData()
                .getMessage()
                .setScreenResponseMessageForUser(ErrorMessages.USER_ID_SENT_TO_EMAIL);
            getScreenDisplayData()
                .getMessage()
                .setScreenResponseMessageColor(ApplicationConstants.SUCCESS_MESSAGE_COLOR);
            getRenderer().getDataRenderer().setUserTextRenderer(true);
            logger.debug("UserID sent to Email Address Successfully");
          } else {
            logger.debug("Invalid Email Address");
            getScreenDisplayData()
                .getMessage()
                .setScreenResponseMessageForUser(ErrorMessages.CONTACT_US_INVALID_EMAIL_ADDRESS);
            commonErrorRendering();
          }
        }
      }
    }
    logger.exiting(CLASS_NAME, METHOD_NAME);
    RedirectScreen.redirectToPage("/DashBoardPointWeb/pages/authentication/login.faces");
  }