コード例 #1
0
  public boolean validateUser(String userEmailId, String userPwd) {
    final String METHOD_NAME = "validateUser()";
    logger.entering(CLASS_NAME, METHOD_NAME);

    UserDetailBO userDetailBO = new MaintainUserBD().fetchUserByEmailId(userEmailId);
    String deshiperPwd = SecurityUtil.decryptText(userDetailBO.getPassword());

    logger.debug("userId" + userEmailId);
    logger.debug("userPwd " + userPwd);
    logger.debug("userDetailBO.getPassword()" + userDetailBO.getPassword());
    logger.debug("deshiperPwd " + deshiperPwd);
    if (userEmailId.equals(userDetailBO.getUserEmailId()) && userPwd.equals(deshiperPwd)) {

      logger.debug("login Successfull");
      logger.debug("userId after login:"******"password after login:"******"NTVERIFD")) {

        RedirectScreen.redirectToPage("/DashBoardPointWeb/pages/user/userRegistration.faces");
      } else {

        RedirectScreen.redirectToPage("/DashBoardPointWeb/pages/home.faces");
      }

      logger.exiting(CLASS_NAME, METHOD_NAME);
      return true;
    } else {
      if (userDetailBO.getUserEmailId() != userEmailId.toUpperCase()) {
        logger.debug("Invalid UserID");
        getScreenDisplayData()
            .getMessage()
            .setScreenResponseMessageForUser(
                ErrorMessages.INVALID_USER_ID_OR_INVALID_PASSWORD_MESSAGE);
        commonErrorRendering();
      }
      if (userDetailBO.getPassword() != userPwd) {
        logger.debug("Invalid password");
        getScreenDisplayData()
            .getMessage()
            .setScreenResponseMessageForUser(
                ErrorMessages.INVALID_USER_ID_OR_INVALID_PASSWORD_MESSAGE);
        commonErrorRendering();
      }
    }
    logger.exiting(CLASS_NAME, METHOD_NAME);
    return false;
  }
コード例 #2
0
  /**
   * This method creates a user
   *
   * @param EntityManager entityManager
   * @param userDetailBO userDetailBO
   * @param ScreenResponseMessageBO messages
   * @return boolean isProcessSuccess;
   */
  public boolean createUser(EntityManager entityManager, UserDetailBO userDetailBO) {
    final String METHOD_NAME =
        "createUser(EntityManager entityManager, UserDetailBO userDetailBO, ScreenResponseMessageBO messages)";
    logger.entering(CLASS_NAME, METHOD_NAME);

    boolean isProcessSuccess = false;
    UserTable userTable = UserObjectPreparationHelper.convertUserDetailBOToUserEntity(userDetailBO);
    boolean flag = false;
    flag = CheckIfUserExistsTask.process(entityManager, userDetailBO.getUserEmailId());
    if (flag == true) {
      logger.debug("Duplicate user creation");
    } else {
      CreateUserTask.process(entityManager, userTable);
      isProcessSuccess = true;
    }
    logger.exiting(CLASS_NAME, METHOD_NAME);
    return isProcessSuccess;
  }
コード例 #3
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");
  }