Refine search
PasswordField field = new PasswordField(); field.getText();
/** * Handles the login. * <p> * In deferred mode, this method is called after the dummy POST request that * triggers the password manager has been completed. In direct mode (the * default setting), it is called directly when the user hits the enter key * or clicks on the login button. In the latter case, you cannot change the * URL in the method or the password manager will not be triggered. */ private void login() { Map<String, String> params = new HashMap<>(); params.put("username", getUsernameField().getValue()); params.put("password", getPasswordField().getValue()); LoginEvent event = new LoginEvent(LoginForm.this, params); fireEvent(event); }
/** * Constructs a PasswordField with given value and caption. * * @param caption * the caption for the field * @param value * the value for the field, not {@code null} */ public PasswordField(String caption, String value) { setValue(value); setCaption(caption); }
PasswordField passwordField = new PasswordField(); passwordField.setStyle("-fx-echo-char: -;");
public AbstractField<?> getTextField(MaduraPropertyWrapper property) { AbstractTextField ret = null; if (property.isSecret()) { ret = new PasswordField(); } else { ret = new TextField(); } ret.setMaxLength(property.getMaxLength()); return ret; } public Button getButtonField(String name, MessageSource messageSource) {
paramLayout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField dashboardBaseUrl = new TextField(); dashboardBaseUrl.setValue(this.platformConfigurationService.getConfigurationValue(ConfigurationConstants.DASHBOARD_BASE_URL)); dashboardBaseUrl.setWidth(400, Unit.PIXELS); paramLayout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); this.passwordField = new PasswordField(); this.passwordField.setWidth(250, Unit.PIXELS); this.passwordField.setValue(this.platformConfigurationService.getWebServicePassword());
public LoginForm(LoginCallback callback) { setMargin(true); setSpacing(true); TextField username = new TextField("Username"); addComponent(username); PasswordField password = new PasswordField("Password"); addComponent(password); Button login = new Button("Login", evt -> { String pword = password.getValue(); password.setValue(""); if (!callback.login(username.getValue(), pword)) { Notification.show("Login failed"); username.focus(); } }); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); addComponent(login); }
final TextField nameField = new TextField("Name", ""); nameField.addListener(changeListener); nameField.setImmediate(true); nameField.setWidth("100%"); final PasswordField passwordField = new PasswordField("Password", ""); passwordField.addListener(changeListener); passwordField.setImmediate(true); passwordField.setWidth("100%");
m_usernameTextField = new TextField(); m_usernameTextField.setCaption("Username"); m_usernameTextField.setImmediate(true); m_usernameTextField.setRequired(true); m_usernameTextField.addListener(changeListener); m_passwordTextField = new PasswordField(); m_passwordTextField.setCaption("Password"); m_passwordTextField.setImmediate(true); m_passwordTextField.setRequired(true); m_passwordTextField.addListener(changeListener);
this.directoryName = new TextField(); this.directoryName.setWidth("400px"); this.directoryName.setRequired(true); this.ldapBindUserPassword = new PasswordField(); this.ldapBindUserPassword.setWidth("100px"); this.ldapBindUserPassword.setRequired(true); this.ldapServerUrl.setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapServerUrl")); this.ldapBindUserDn.setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapBindUserDn")); this.ldapBindUserPassword.setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapBindUserPassword")); this.ldapUserSearchDn.setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapUserSearchBaseDn")); this.ldapUserSearchFilter.setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapUserSearchFilter"));
imapForm.setDescription(i18nManager.getMessage(Messages.IMAP_DESCRIPTION)); final TextField imapServer = new TextField(i18nManager.getMessage(Messages.IMAP_SERVER)); imapForm.getLayout().addComponent(imapServer); final TextField imapPort = new TextField(i18nManager.getMessage(Messages.IMAP_PORT)); imapPort.setWidth(30, UNITS_PIXELS); imapPort.setValue(143); // Default imap port (non-ssl) imapForm.getLayout().addComponent(imapPort); imapForm.getLayout().addComponent(imapUserName); final PasswordField imapPassword = new PasswordField(i18nManager.getMessage(Messages.IMAP_PASSWORD)); imapForm.getLayout().addComponent(imapPassword);
@Override public void buttonClick(ClickEvent event) { try { userNameField.validate(); passwordField.validate(); } catch (InvalidValueException e) { userNameField.setValidationVisible(true); passwordField.setValidationVisible(true); return; } try { binder.commit(); ikasanAuthentication = (IkasanAuthentication)authenticationService.authenticateLocal (userNameField.getValue(), passwordField.getValue()); userNameField.setValue(""); passwordField.setValue(""); close(); } catch (Exception e) { Notification.show(e.getMessage(), Notification.Type.ERROR_MESSAGE); } } });
setWidth("20%"); m_usernameTextField = new TextField(); m_usernameTextField.setEnabled(false); m_usernameTextField.setCaption("Username"); m_passwordTextField = new PasswordField(); m_passwordTextField.setCaption("Password"); m_passwordTextField.setImmediate(true); m_passwordTextField.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) {
private void login() { if (accessControl.signIn(username.getValue(), password.getValue())) { Subject subject = (Subject)UI.getCurrent().getSession().getAttribute(VaadinAccessControl.SUBJECT_ATTR); if (subject == null) MLogUtil.log().i("no subject"); else MLogUtil.log().i("Login",subject); // if (MSecurity.hasRole(subject,MAIN_USER_ROLE)) { loginListener.loginSuccessful(); return; // } else { // accessControl.signOut(); // } } showNotification(new Notification(MNls.find(this,"login.error.title=Login failed"), MNls.find(this,"login.error.text=Please check your username and password and try again."), Notification.Type.HUMANIZED_MESSAGE)); username.focus(); }
loginForm.setMargin(false); loginForm.addComponent(username = new TextField(MNls.find(this,"login.username=Username"), "")); username.setWidth(15, Unit.EM); loginForm.addComponent(password = new PasswordField(MNls.find(this,"login.password=Password"))); password.setWidth(15, Unit.EM); password.setDescription(MNls.find(this,"login.password.description=Your password")); CssLayout buttons = new CssLayout(); buttons.setStyleName("buttons");
textField.key.validate(); textField.value.validate(); usernameField.validate(); passwordField.validate(); textField.value.setValidationVisible(true); usernameField.setValidationVisible(true); passwordField.setValidationVisible(true); userParam.setValue(usernameField.getValue()); passwordParam.setValue(passwordField.getValue());
public LoginPanel() { setSpacing(true); setMargin(true); setClosable(false); setSizeFull(); m_name = new TextField("Name", ""); m_password = new PasswordField("Password", ""); m_loginButton = new Button("Login"); addComponent(m_name); addComponent(m_password); addComponent(m_loginButton); setComponentAlignment(m_loginButton, Alignment.BOTTOM_CENTER); m_name.focus(); m_name.selectAll(); m_loginButton.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { if (login((String) m_name.getValue(), (String) m_password.getValue())) { closeWindow(); } else { // TODO provide some feedback, login failed, for now don't close the login window m_loginButton.setComponentError(new UserError("Invalid username or password.")); } } }); } }
submitCaption = messageSourceAccessor.getMessage("login.button"); welcomeCaption = messageSourceAccessor.getMessage("welcome"); final TextField userName = new TextField(usernameCaption); userName.setImmediate(true); addField("userName", userName); final PasswordField password = new PasswordField(passwordCaption); password.setImmediate(true); addField("password", password); Button submit = new Button(submitCaption);
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_EMAIL), new Label(user.getEmail())); } else { firstNameField = new TextField(null, user.getFirstName() != null ? user.getFirstName() : ""); addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_FIRSTNAME), firstNameField); firstNameField.focus(); lastNameField = new TextField(null, user.getLastName() != null ? user.getLastName() : ""); addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_LASTNAME), lastNameField); addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_EMAIL), emailField); passwordField = new PasswordField(); Label cautionLabel = new Label(i18nManager.getMessage(Messages.USER_RESET_PASSWORD)); cautionLabel.addStyleName(Reindeer.LABEL_SMALL);