예제 #1
0
  /**
   * Create contents of the button bar.
   *
   * @param parent
   */
  @Override
  protected void createButtonsForButtonBar(Composite parent) {
    //		createButton(parent, IDialogConstants.OK_ID, Messages.get().LoginDialog_15, true);

    createButton(parent, ID_NEW_USER, Messages.get().LoginDialog_button_text_1, false);
    try {
      SMTPDTO smtpDto = GetAdminPreference.getSessionSMTPINFO();
      if (!"".equals(smtpDto.getEmail())) { // $NON-NLS-1$
        createButton(parent, ID_FINDPASSWORD, Messages.get().LoginDialog_lblFindPassword, false);
      }
    } catch (Exception e) {
      //			logger.error("view findpasswd button", e);
      //			ignore exception
    }
  }
예제 #2
0
  /**
   * validation
   *
   * @param strEmail
   * @param strPass
   */
  private boolean validation(String strEmail, String strPass) {
    // validation
    if ("".equals(strEmail)) { // $NON-NLS-1$
      MessageDialog.openError(
          getParentShell(), Messages.get().LoginDialog_7, Messages.get().LoginDialog_11);
      textEMail.setFocus();
      return false;
    } else if ("".equals(strPass)) { // $NON-NLS-1$
      MessageDialog.openError(
          getParentShell(), Messages.get().LoginDialog_7, Messages.get().LoginDialog_14);
      textPasswd.setFocus();
      return false;
    }

    return true;
  }
예제 #3
0
  /** 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);
    }
  }
예제 #4
0
  /**
   * change ui locale
   *
   * @param strComoboStr
   */
  private void changeUILocale(String strComoboStr) {
    Locale localeSelect = (Locale) comboLanguage.getData(strComoboStr);
    RWT.getUISession().setLocale(localeSelect);

    btnCheckButton.setText(Messages.get().LoginDialog_9);
    lblEmail.setText(Messages.get().LoginDialog_1);
    lblPassword.setText(Messages.get().LoginDialog_4);
    lblLanguage.setText(Messages.get().LoginDialog_lblLanguage_text);

    compositeLetter.setText(Messages.get().LoginDialog_grpShowInformation_text);
    lblSite.setText(Messages.get().LoginDialog_lblSite_text);
    lblUserGuide.setText(Messages.get().LoginDialog_lblUserGuide_text);
    lblContact.setText(Messages.get().LoginDialog_lblContact_text_1);

    compositeLetter.layout();
    compositeLogin.layout();
  }
예제 #5
0
  @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();
  }
예제 #6
0
  /**
   * Create contents of the dialog.
   *
   * @param parent
   */
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) container.getLayout();
    gridLayout.numColumns = 2;
    gridLayout.verticalSpacing = 5;
    gridLayout.horizontalSpacing = 5;
    gridLayout.marginHeight = 5;
    gridLayout.marginWidth = 5;

    Composite compositeLeftBtn = new Composite(container, SWT.NONE);
    compositeLeftBtn.setLayout(new GridLayout(1, false));

    Button button = new Button(compositeLeftBtn, SWT.NONE);
    button.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    button.setImage(
        ResourceManager.getPluginImage(
            BrowserActivator.ID, "resources/TadpoleOverView.png")); // $NON-NLS-1$

    compositeLogin = new Composite(container, SWT.NONE);
    compositeLogin.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    compositeLogin.setLayout(new GridLayout(3, false));

    lblEmail = new Label(compositeLogin, SWT.NONE);
    lblEmail.setText(Messages.get().LoginDialog_1);

    textEMail = new Text(compositeLogin, SWT.BORDER);
    textEMail.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyReleased(KeyEvent e) {
            if (e.keyCode == SWT.Selection) {
              if (!"".equals(textPasswd.getText())) okPressed(); // $NON-NLS-1$
              else textPasswd.setFocus();
            }
          }
        });
    textEMail.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    btnCheckButton = new Button(compositeLogin, SWT.CHECK);
    btnCheckButton.setText(Messages.get().LoginDialog_9); // $NON-NLS-1$

    lblPassword = new Label(compositeLogin, SWT.NONE);
    lblPassword.setText(Messages.get().LoginDialog_4);

    textPasswd = new Text(compositeLogin, SWT.BORDER | SWT.PASSWORD);
    textPasswd.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyReleased(KeyEvent e) {
            if (e.keyCode == SWT.Selection) {
              okPressed();
            }
          }
        });
    textPasswd.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Button btnLogin = new Button(compositeLogin, SWT.NONE);
    btnLogin.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            okPressed();
          }
        });
    btnLogin.setText(Messages.get().LoginDialog_15);

    lblLanguage = new Label(compositeLogin, SWT.NONE);
    lblLanguage.setText(Messages.get().LoginDialog_lblLanguage_text);

    comboLanguage = new Combo(compositeLogin, SWT.READ_ONLY);
    comboLanguage.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            changeUILocale();
          }
        });
    comboLanguage.add(Locale.ENGLISH.getDisplayLanguage());
    comboLanguage.add(Locale.KOREAN.getDisplayLanguage());

    comboLanguage.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    comboLanguage.setData(Locale.ENGLISH.getDisplayLanguage(), Locale.ENGLISH);
    comboLanguage.setData(Locale.KOREAN.getDisplayLanguage(), Locale.KOREAN);

    //		comboLanguage.select(0);

    // ---------------------  Registered database
    // ----------------------------------------------------
    //		try {
    //			listDBMart = getDBMart();
    //			if(!listDBMart.isEmpty()) {
    //				Group grpSponser = new Group(container, SWT.NONE);
    //				GridLayout gl_grpSponser = new GridLayout(1, false);
    //				gl_grpSponser.verticalSpacing = 0;
    //				gl_grpSponser.horizontalSpacing = 0;
    //				gl_grpSponser.marginHeight = 0;
    //				gl_grpSponser.marginWidth = 0;
    //				grpSponser.setLayout(gl_grpSponser);
    //				grpSponser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    //				grpSponser.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLUE));
    //				grpSponser.setText(Messages.get().LoginDialog_grpSponser_text);
    //
    //				makeBarChart(grpSponser, listDBMart);
    //			}
    //		} catch(Exception e) {
    //			logger.error("get initdata", e); //$NON-NLS-1$
    //		}

    compositeLetter = new Group(container, SWT.NONE);
    compositeLetter.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
    GridLayout gl_compositeLetter = new GridLayout(2, false);
    compositeLetter.setLayout(gl_compositeLetter);
    compositeLetter.setText(Messages.get().LoginDialog_grpShowInformation_text);

    lblSite = new Label(compositeLetter, SWT.NONE);
    lblSite.setText(Messages.get().LoginDialog_lblSite_text);

    Label lblNewLabel = new Label(compositeLetter, SWT.NONE);
    lblNewLabel.setText(
        "<a href='"
            + Messages.get().LoginDialog_lblNewLabel_text_1
            + "' target='_blank'>"
            + Messages.get().LoginDialog_lblNewLabel_text_1
            + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    lblNewLabel.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    lblUserGuide = new Label(compositeLetter, SWT.NONE);
    lblUserGuide.setText(Messages.get().LoginDialog_lblUserGuide_text);

    Composite compositeUserGide = new Composite(compositeLetter, SWT.NONE);
    compositeUserGide.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    GridLayout gl_compositeUserGide = new GridLayout(3, false);
    gl_compositeUserGide.verticalSpacing = 1;
    gl_compositeUserGide.horizontalSpacing = 1;
    gl_compositeUserGide.marginHeight = 1;
    gl_compositeUserGide.marginWidth = 1;
    compositeUserGide.setLayout(gl_compositeUserGide);

    Label lblUserKor = new Label(compositeUserGide, SWT.NONE);
    lblUserKor.setText(
        "<a href='https://tadpoledbhub.atlassian.net/wiki/pages/viewpage.action?pageId=20578325' target='_blank'>(Korean)</a>"); //$NON-NLS-1$ //$NON-NLS-2$
    lblUserKor.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    Label lblUserEng = new Label(compositeUserGide, SWT.NONE);
    lblUserEng.setText(
        "<a href='https://github.com/hangum/TadpoleForDBTools/wiki/RDB-User-Guide-Eng' target='_blank'>(English)</a>"); //$NON-NLS-1$ //$NON-NLS-2$
    lblUserEng.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    Label lblUserIndonesia = new Label(compositeUserGide, SWT.NONE);
    lblUserIndonesia.setText(
        "<a href='https://github.com/hangum/TadpoleForDBTools/wiki/RDB-User-Guide-ID' target='_blank'>(Indonesia)</a>"); //$NON-NLS-1$ //$NON-NLS-2$
    lblUserIndonesia.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    //		Label lblIssues = new Label(compositeLetter, SWT.NONE);
    //		lblIssues.setText(Messages.get().LoginDialog_lblIssues_text);
    //
    //		Label lblIssue = new Label(compositeLetter, SWT.NONE);
    //		lblIssue.setText("<a href='https://github.com/hangum/TadpoleForDBTools/issues'
    // target='_blank'>https://github.com/hangum/TadpoleForDBTools/issues</a>"); //$NON-NLS-1$
    // //$NON-NLS-2$
    //		lblIssue.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    lblContact = new Label(compositeLetter, SWT.NONE);
    lblContact.setText(Messages.get().LoginDialog_lblContact_text_1);

    Label lblContactUrl = new Label(compositeLetter, SWT.NONE);
    try {
      UserDAO systemUserDao = TadpoleApplicationContextManager.getSystemAdmin();
      lblContactUrl.setText(
          String.format(
              "<a href='mailto:%s'>%s(%s)</a>",
              systemUserDao.getEmail(),
              systemUserDao.getName(),
              systemUserDao.getEmail())); // $NON-NLS-1$ //$NON-NLS-2$
    } catch (Exception e1) {
      lblContactUrl.setText(
          "<a href='mailto:[email protected]'>Admin([email protected])</a>"); //$NON-NLS-1$
      // //$NON-NLS-2$
    }
    lblContactUrl.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    Label lblDonation = new Label(compositeLetter, SWT.NONE);
    //		lblDonation.setText(Messages.get().LoginDialog_lblDonation_text);

    Browser browser = new Browser(compositeLetter, SWT.NONE);
    browser.setLayoutData(new GridData(SWT.FILL, SWT.RIGHT, false, false, 1, 1));
    browser.setText(strPaypal);

    AnalyticCaller.track("login"); // $NON-NLS-1$

    initUI();

    return compositeLogin;
  }