@Override public String getColumnText(Object element, int columnIndex) { UserDAO user = (UserDAO) element; switch (columnIndex) { case 0: return user.getEmail(); case 1: return user.getName(); case 2: return user.getAllow_ip(); case 3: return user.getIs_regist_db(); case 4: return user.getEmail_key(); case 5: return user.getApproval_yn(); case 6: return user.getIs_email_certification(); case 7: return user.getDelYn(); case 8: return user.getCreate_time(); } return "*** not set column ***"; }
@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(); }
/** * 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; }