/** initialize ui */
  private void initUI() {
    String defaultLanguage = RWT.getUISession().getLocale().getDisplayLanguage();
    boolean isFound = false;
    for (String strName : comboLanguage.getItems()) {
      if (strName.equals(defaultLanguage)) {
        isFound = true;
        comboLanguage.setText(strName);
        changeUILocale(comboLanguage.getText());

        break;
      }
    }
    if (!isFound) {
      comboLanguage.select(0);
      changeUILocale(comboLanguage.getText());
    }

    // find login id
    initCookieData();
    if ("".equals(textEMail.getText())) {
      textEMail.setFocus();
    } else {
      textPasswd.setFocus();
    }

    // check support browser
    if (!RequestInfoUtils.isSupportBrowser()) {
      String errMsg =
          Messages.get().LoginDialog_30
              + RequestInfoUtils.getUserBrowser()
              + ".\n"
              + Messages.get().UserInformationDialog_5
              + "\n"
              + Messages.get()
                  .LoginDialog_lblNewLabel_text; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
      MessageDialog.openError(getParentShell(), Messages.get().LoginDialog_7, errMsg);
    }
  }
  @Override
  protected void okPressed() {
    String strEmail = StringUtils.trimToEmpty(textEMail.getText());
    String strPass = StringUtils.trimToEmpty(textPasswd.getText());

    if (!validation(strEmail, strPass)) return;

    try {
      UserDAO userDao = TadpoleSystem_UserQuery.login(strEmail, strPass);

      // firsttime email confirm
      if (PublicTadpoleDefine.YES_NO.NO.name().equals(userDao.getIs_email_certification())) {
        InputDialog inputDialog =
            new InputDialog(
                getShell(),
                Messages.get().LoginDialog_10,
                Messages.get().LoginDialog_17,
                "",
                null); //$NON-NLS-3$ //$NON-NLS-1$
        if (inputDialog.open() == Window.OK) {
          if (!userDao.getEmail_key().equals(inputDialog.getValue())) {
            throw new Exception(Messages.get().LoginDialog_19);
          } else {
            TadpoleSystem_UserQuery.updateEmailConfirm(strEmail);
          }
        } else {
          throw new Exception(Messages.get().LoginDialog_20);
        }
      }

      if (PublicTadpoleDefine.YES_NO.NO.name().equals(userDao.getApproval_yn())) {
        MessageDialog.openError(
            getParentShell(), Messages.get().LoginDialog_7, Messages.get().LoginDialog_27);

        return;
      }

      // Check the allow ip
      String strAllowIP = userDao.getAllow_ip();
      boolean isAllow = IPFilterUtil.ifFilterString(strAllowIP, RequestInfoUtils.getRequestIP());
      if (logger.isDebugEnabled())
        logger.debug(
            Messages.get().LoginDialog_21
                + userDao.getEmail()
                + Messages.get().LoginDialog_22
                + strAllowIP
                + Messages.get().LoginDialog_23
                + RequestInfoUtils.getRequestIP());
      if (!isAllow) {
        logger.error(
            Messages.get().LoginDialog_21
                + userDao.getEmail()
                + Messages.get().LoginDialog_22
                + strAllowIP
                + Messages.get().LoginDialog_26
                + RequestInfoUtils.getRequestIP());
        MessageDialog.openError(
            getParentShell(), Messages.get().LoginDialog_7, Messages.get().LoginDialog_28);
        return;
      }

      if (PublicTadpoleDefine.YES_NO.YES.name().equals(userDao.getUse_otp())) {
        OTPLoginDialog otpDialog = new OTPLoginDialog(getShell());
        otpDialog.open();

        if (!GoogleAuthManager.getInstance()
            .isValidate(userDao.getOtp_secret(), otpDialog.getIntOTPCode())) {
          throw new Exception(Messages.get().LoginDialog_2);
        }
      }

      // 로그인 유지.
      registLoginID(userDao.getEmail());

      SessionManager.addSession(userDao);

      // save login_history
      TadpoleSystem_UserQuery.saveLoginHistory(userDao.getSeq());
    } catch (Exception e) {
      logger.error(
          String.format(
              "Login exception. request email is %s, reason %s",
              strEmail, e.getMessage())); // $NON-NLS-1$
      MessageDialog.openError(getParentShell(), Messages.get().LoginDialog_29, e.getMessage());

      textPasswd.setFocus();
      return;
    }

    super.okPressed();
  }