List of usage examples for com.vaadin.ui PasswordField PasswordField
public PasswordField(ValueChangeListener<String> valueChangeListener)
From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java
private Component buildFields() { HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true);/* w ww. j av a 2 s . c o m*/ fields.addStyleName("fields"); final TextField username = new TextField("Username"); username.setIcon(FontAwesome.USER); username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final PasswordField password = new PasswordField("Password"); password.setIcon(FontAwesome.LOCK); password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final Button signin = new Button("Sign In"); signin.addStyleName(ValoTheme.BUTTON_PRIMARY); signin.setClickShortcut(KeyCode.ENTER); signin.focus(); fields.addComponents(username, password, signin); fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT); signin.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { System.out.println("TRIGGER LOGIN"); DashboardEventBus.post(new UserLoginRequestedEvent(username.getValue(), password.getValue())); } }); return fields; }
From source file:de.fatalix.app.view.login.LoginView.java
private Component buildLoginForm() { FormLayout loginForm = new FormLayout(); loginForm.addStyleName("login-form"); loginForm.setSizeUndefined();//from w w w . j av a 2s. com loginForm.setMargin(false); loginForm.addComponent(username = new TextField("Username", "admin")); username.setWidth(15, Unit.EM); loginForm.addComponent(password = new PasswordField("Password")); password.setWidth(15, Unit.EM); password.setDescription("Write anything"); CssLayout buttons = new CssLayout(); buttons.setStyleName("buttons"); loginForm.addComponent(buttons); buttons.addComponent(login = new Button("Login")); login.setDisableOnClick(true); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { presenter.doLogin(username.getValue(), password.getValue()); } catch (AuthenticationException ex) { LoginView.this.showNotification( new Notification("Wrong login", Notification.Type.ERROR_MESSAGE), ValoTheme.NOTIFICATION_FAILURE); } finally { login.setEnabled(true); } } }); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addStyleName(ValoTheme.BUTTON_FRIENDLY); buttons.addComponent(forgotPassword = new Button("Forgot password?")); forgotPassword.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { showNotification(new Notification("Hint: Try anything", Notification.Type.HUMANIZED_MESSAGE), ValoTheme.NOTIFICATION_SUCCESS); } }); forgotPassword.addStyleName(ValoTheme.BUTTON_LINK); return loginForm; }
From source file:de.fatalix.bookery.view.login.LoginView.java
License:Open Source License
private Component buildLoginForm() { FormLayout loginForm = new FormLayout(); loginForm.addStyleName("login-form"); loginForm.setSizeUndefined();/*from w ww.java2s . c om*/ loginForm.setMargin(false); loginForm.addComponent(username = new TextField("Username", "admin")); username.setWidth(15, Unit.EM); loginForm.addComponent(password = new PasswordField("Password")); password.setWidth(15, Unit.EM); password.setDescription(""); CssLayout buttons = new CssLayout(); buttons.setStyleName("buttons"); loginForm.addComponent(buttons); login = new Button("login"); buttons.addComponent(login); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { presenter.doLogin(username.getValue(), password.getValue()); } catch (AuthenticationException ex) { LoginView.this.showNotification( new Notification("Wrong login", Notification.Type.ERROR_MESSAGE), ValoTheme.NOTIFICATION_FAILURE); } finally { login.setEnabled(true); } } }); login.addStyleName(ValoTheme.BUTTON_FRIENDLY); buttons.addComponent(forgotPassword = new Button("Forgot password?")); forgotPassword.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { showNotification(new Notification("Hint: Ask me", Notification.Type.HUMANIZED_MESSAGE), ValoTheme.NOTIFICATION_SUCCESS); } }); forgotPassword.addStyleName(ValoTheme.BUTTON_LINK); Panel loginPanel = new Panel(loginForm); loginPanel.setWidthUndefined(); loginPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); loginPanel.addAction(new ShortcutListener("commit", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { try { presenter.doLogin(username.getValue(), password.getValue()); } catch (AuthenticationException ex) { LoginView.this.showNotification( new Notification("Wrong login", Notification.Type.ERROR_MESSAGE), ValoTheme.NOTIFICATION_FAILURE); } } }); return loginPanel; }
From source file:de.gedoplan.webclients.vaadin.LoginUi.java
@Override protected void init(VaadinRequest request) { TextField name = new TextField(Messages.login_name.value()); name.focus();//from w w w. j a v a 2 s . com PasswordField password = new PasswordField(Messages.login_password.value()); Button login = new Button(Messages.login_submit.value(), e -> { try { JaasAccessControl.login(name.getValue(), password.getValue()); Page.getCurrent().setLocation(Konstanten.VAADIN_UI_PATH); } catch (ServletException ex) { Notification.show(Messages.login_invalid.value(), Notification.Type.ERROR_MESSAGE); } }); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); FormLayout fieldLayout = new FormLayout(name, password, login); fieldLayout.setMargin(true); fieldLayout.setSpacing(true); Panel loginPanel = new Panel(Messages.login_title.value(), fieldLayout); loginPanel.setSizeUndefined(); VerticalLayout page = new VerticalLayout(); page.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); page.addComponent(loginPanel); page.setSizeFull(); setContent(page); }
From source file:de.kaiserpfalzEdv.vaadin.LoginScreen.java
License:Apache License
private Component buildLoginForm() { FormLayout loginForm = new FormLayout(); loginForm.addStyleName("login-form"); loginForm.setSizeUndefined();//from w ww . jav a 2 s. c om loginForm.setMargin(false); loginForm.addComponent(username = new TextField(translate("login.name.caption"))); username.setDescription(translate("login.name.description")); username.setWidth(15, Unit.EM); loginForm.addComponent(password = new PasswordField(translate("login.password.caption"))); password.setWidth(15, Unit.EM); password.setDescription(translate("login.password.description")); CssLayout buttons = new CssLayout(); buttons.setStyleName("buttons"); loginForm.addComponent(buttons); login = new Button(translate("login.login-button.caption")); buttons.addComponent(login); login.setDescription(translate("login.login-button.description")); login.setDisableOnClick(true); login.addClickListener(event -> { try { login(); } finally { login.setEnabled(true); } }); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addStyleName(ValoTheme.BUTTON_FRIENDLY); Button forgotPassword; buttons.addComponent(forgotPassword = new Button(translate("login.password-forgotten.caption"))); forgotPassword.setDescription(translate("login.password-forgotten.description")); forgotPassword.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { NotificationPayload notification = new NotificationPayload("login.password-forgotten.text"); bus.post(new NotificationEvent(this, notification)); } }); forgotPassword.addStyleName(ValoTheme.BUTTON_LINK); return loginForm; }
From source file:de.mediapool.web.ui.login.MediaLoginFormSpring.java
License:Apache License
@Override public Field createField(Item item, Object propertyId, Component uiContext) { String pid = (String) propertyId; if (pid.equals("password")) { PasswordField passwordField = new PasswordField("password"); passwordField.setNullRepresentation(""); return passwordField; } else if (pid.equals("email")) { TextField tf = new TextField("email"); tf.setNullRepresentation(""); return tf; }//from w w w . jav a 2 s . co m return null; }
From source file:de.metas.procurement.webui.ui.view.LoginView.java
License:Open Source License
public LoginView() { super();/*from ww w . j av a 2 s . c o m*/ Application.autowire(this); addStyleName(STYLE); // // Content { final VerticalComponentGroup content = new VerticalComponentGroup(); final Resource logoResource = getLogoResource(); final Image logo = new Image(null, logoResource); logo.addStyleName(STYLE_Logo); content.addComponent(logo); this.email = new EmailField(i18n.get("LoginView.fields.email")); email.addStyleName(STYLE_LoginEmail); email.setIcon(FontAwesome.USER); content.addComponent(email); this.password = new PasswordField(i18n.get("LoginView.fields.password")); password.addStyleName(STYLE_LoginPassword); password.setIcon(FontAwesome.LOCK); content.addComponent(password); final Button loginButton = new Button(i18n.get("LoginView.fields.loginButton")); loginButton.addStyleName(STYLE_LoginButton); loginButton.setClickShortcut(KeyCode.ENTER); loginButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { onUserLogin(email.getValue(), password.getValue()); } }); final Button forgotPasswordButton = new Button(i18n.get("LoginView.fields.forgotPasswordButton")); forgotPasswordButton.setStyleName(STYLE_ForgotPasswordButton); forgotPasswordButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { onForgotPassword(email.getValue()); } }); final CssLayout contentWrapper = new CssLayout(content, loginButton, forgotPasswordButton); contentWrapper.addStyleName(STYLE_LoginFormWrapper); setContent(contentWrapper); } // // Bottom: { // // Powered-by logo resource // Use the configured one if any; fallback to default embedded powered-by logo final Resource poweredByLogoResource; if (poweredByLogoUrl != null && !poweredByLogoUrl.trim().isEmpty()) { poweredByLogoResource = new ExternalResource(poweredByLogoUrl.trim()); } else { poweredByLogoResource = Constants.RESOURCE_PoweredBy; } // // Powered-by component: final Component poweredByComponent; if (poweredByLinkUrl != null && !poweredByLinkUrl.trim().isEmpty()) { final Link link = new Link(); link.setIcon(poweredByLogoResource); link.setResource(new ExternalResource(poweredByLinkUrl.trim())); link.setTargetName("_blank"); poweredByComponent = link; } else { final Image image = new Image(null, poweredByLogoResource); poweredByComponent = image; } // poweredByComponent.addStyleName(STYLE_PoweredBy); setToolbar(poweredByComponent); } }
From source file:de.unioninvestment.portal.explorer.view.vfs.ConfigView.java
License:Apache License
public ConfigView(ConfigBean cb, VFSFileExplorerPortlet instance) { final OptionGroup group = new OptionGroup("Type"); group.addItem("FILE"); group.addItem("FTP"); group.addItem("SFTP"); group.setValue(cb.getVfsType());//ww w. j a va 2 s . c o m group.setImmediate(true); final TextField tfDirectory = new TextField("Directory"); tfDirectory.setValue(cb.getVfsUrl()); final TextField tfKeyFile = new TextField("Keyfile"); tfKeyFile.setValue(cb.getKeyfile()); final TextField tfProxyHost = new TextField("Proxy Host (sftp)"); tfProxyHost.setValue(cb.getProxyHost()); final TextField tfProxyPort = new TextField("Proxy Port (sftp)"); tfProxyPort.setValue(cb.getProxyPort()); final TextField tfUser = new TextField("User"); tfUser.setValue(cb.getUsername()); final PasswordField tfPw = new PasswordField("Password"); tfPw.setValue(cb.getPassword()); final CheckBox cbUploadEnabled = new CheckBox("Upload Enabled"); if (cb.isUploadEnabled()) { cbUploadEnabled.setValue(true); } else cbUploadEnabled.setValue(false); final TextField tfRolesUpload = new TextField("Upload Rollen"); tfRolesUpload.setValue(cb.getUploadRoles()); final CheckBox cbDeleteEnabled = new CheckBox("Delete Enabled"); if (cb.isDeleteEnabled()) { cbDeleteEnabled.setValue(true); } else cbDeleteEnabled.setValue(false); final TextField tfRolesDelete = new TextField("Delete Rollen"); tfRolesDelete.setValue(cb.getDeleteRoles()); group.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; public void valueChange(ValueChangeEvent event) { setVisibleFields(group, tfKeyFile, tfProxyHost, tfProxyPort, tfUser, tfPw); } }); setVisibleFields(group, tfKeyFile, tfProxyHost, tfProxyPort, tfUser, tfPw); Button saveProps = new Button("Save"); final VFSFileExplorerPortlet app = instance; saveProps.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { try { PortletPreferences prefs = app.getPortletPreferences(); String type = group.getValue().toString(); prefs.setValue("type", type); String con = tfDirectory.getValue().toString(); prefs.setValue("directory", con); String key = tfKeyFile.getValue().toString(); prefs.setValue("keyfile", key); String proxyHost = tfProxyHost.getValue().toString(); prefs.setValue("proxyHost", proxyHost); String proxyPort = tfProxyPort.getValue().toString(); prefs.setValue("proxyPort", proxyPort); String uploadRoles = tfRolesUpload.getValue().toString(); prefs.setValue("uploadRoles", uploadRoles); String deleteRoles = tfRolesDelete.getValue().toString(); prefs.setValue("deleteRoles", deleteRoles); String username = tfUser.getValue().toString(); prefs.setValue("username", username); String password = tfPw.getValue().toString(); prefs.setValue("password", password); Boolean bDel = (Boolean) cbDeleteEnabled.getValue(); Boolean bUpl = (Boolean) cbUploadEnabled.getValue(); if (bDel) prefs.setValue("deleteEnabled", "true"); else prefs.setValue("deleteEnabled", "false"); if (bUpl) prefs.setValue("uploadEnabled", "true"); else prefs.setValue("uploadEnabled", "false"); prefs.store(); logger.log(Level.INFO, "Roles Upload " + prefs.getValue("uploadEnabled", "-")); logger.log(Level.INFO, "Roles Delete " + prefs.getValue("deleteEnabled", "-")); ConfigBean cb = new ConfigBean(type, bDel, false, bUpl, con, username, password, key, proxyHost, proxyPort, uploadRoles, deleteRoles); app.getEventBus().fireEvent(new ConfigChangedEvent(cb)); } catch (Exception e) { logger.log(Level.INFO, "Exception " + e.toString()); e.printStackTrace(); } } }); addComponent(group); addComponent(tfDirectory); addComponent(tfKeyFile); addComponent(tfProxyHost); addComponent(tfProxyPort); addComponent(tfUser); addComponent(tfPw); HorizontalLayout ul = new HorizontalLayout(); ul.setSpacing(true); ul.addComponent(cbUploadEnabled); ul.addComponent(tfRolesUpload); ul.setComponentAlignment(cbUploadEnabled, Alignment.MIDDLE_CENTER); ul.setComponentAlignment(tfRolesUpload, Alignment.MIDDLE_CENTER); addComponent(ul); HorizontalLayout dl = new HorizontalLayout(); dl.setSpacing(true); dl.addComponent(cbDeleteEnabled); dl.addComponent(tfRolesDelete); dl.setComponentAlignment(cbDeleteEnabled, Alignment.MIDDLE_CENTER); dl.setComponentAlignment(tfRolesDelete, Alignment.MIDDLE_CENTER); addComponent(dl); addComponent(saveProps); }
From source file:dhbw.clippinggorilla.userinterface.windows.PasswordRecoveryWindow.java
public void changeWindow() { String errorMsg;//from w ww . jav a 2s. co m if (emailOrUsername.getValue().contains("@")) { errorMsg = UserUtils.checkEmailOnFormalCorrectness(emailOrUsername.getValue().toLowerCase()); } else { errorMsg = UserUtils.checkUsernameOnFormalCorrectness(emailOrUsername.getValue()); } if (errorMsg.isEmpty()) { VaadinUtils.middleInfoNotification(Language.get(Word.IF_USER_EXIST_CHECK_MAIL)); try { String stringEmailOrUsername = emailOrUsername.getValue(); if (stringEmailOrUsername.contains("@")) { stringEmailOrUsername = stringEmailOrUsername.toLowerCase(); } String token = UserUtils.initiateForgottenPasswordRecovery(stringEmailOrUsername); forms.removeAllComponents(); TextField resetCode = new TextField(Language.get(Word.RESET_CODE)); resetCode.setMaxLength(6); resetCode.addValueChangeListener(e -> { if (resetCode.getValue().length() > 5) { resetCode.setComponentError(null); setError(resetCode, false); } else { resetCode.setComponentError(new UserError(Language.get(Word.RESET_CODE_SIX_CHARS), AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(Language.get(Word.RESET_CODE_SIX_CHARS)); setError(resetCode, true); } }); ProgressBar strength = new ProgressBar(); PasswordField pw1 = new PasswordField(Language.get(Word.PASSWORD)); pw1.setMaxLength(51); pw1.addValueChangeListener(e -> { String pwErrorMsg = UserUtils.checkPassword(e.getValue()); strength.setValue(UserUtils.calculatePasswordStrength(e.getValue())); if (!pwErrorMsg.isEmpty()) { pw1.setComponentError(new UserError(pwErrorMsg, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.ERROR)); VaadinUtils.infoNotification(pwErrorMsg); setError(pw1, true); } else { pw1.setComponentError(null); setError(pw1, false); } }); strength.setWidth("184px"); strength.setHeight("1px"); PasswordField pw2 = new PasswordField(Language.get(Word.PASSWORD_AGAIN)); pw2.setMaxLength(51); pw2.addValueChangeListener(e -> { String pwErrorMsg = UserUtils.checkSecondPassword(pw1.getValue(), e.getValue()); if (!pwErrorMsg.isEmpty()) { pw2.setComponentError(new UserError(pwErrorMsg, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.ERROR)); VaadinUtils.infoNotification(pwErrorMsg); setError(pw2, true); } else { pw2.setComponentError(null); setError(pw2, false); } }); send.setCaption(Language.get(Word.RESET)); send.setEnabled(false); sendListener.remove(); send.addClickListener(ce -> { try { UserUtils.executeForgottenPasswordRecovery(emailOrUsername.getValue(), resetCode.getValue(), token, pw1.getValue(), pw2.getValue()); VaadinUtils.infoNotification(Language.get(Word.RESET_SUCCESSFUL)); close(); } catch (PasswordChangeException ex) { VaadinUtils.infoNotification(Language.get(Word.RESET_FAILED)); } }); forms.addComponents(resetCode, pw1, strength, pw2); center(); } catch (UserNotFoundException e) { VaadinUtils.errorNotification(Language.get(Word.RESET_FAILED)); } } else { VaadinUtils.infoNotification(errorMsg); } }
From source file:dhbw.clippinggorilla.userinterface.windows.PreferencesWindow.java
private Component buildUserTab(User user) { HorizontalLayout root = new HorizontalLayout(); root.setCaption(Language.get(Word.PROFILE)); root.setIcon(VaadinIcons.USER);// w w w . j ava 2 s. co m root.setWidth("100%"); root.setSpacing(true); root.setMargin(true); FormLayout details = new FormLayout(); details.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); root.addComponent(details); firstNameField = new TextField(Language.get(Word.FIRST_NAME)); firstNameField.setValue(user.getFirstName()); firstNameField.setMaxLength(20); firstNameField.addValueChangeListener(event -> { String firstNameError = UserUtils.checkName(event.getValue()); if (!firstNameError.isEmpty()) { firstNameField.setComponentError(new UserError(firstNameError, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(firstNameError); saveButton.setEnabled(setError(firstNameField, true)); } else { firstNameField.setComponentError(null); boolean enabled = setError(firstNameField, false); saveButton.setEnabled(enabled); } }); setError(firstNameField, false); lastNameField = new TextField(Language.get(Word.LAST_NAME)); lastNameField.setValue(user.getLastName()); lastNameField.setMaxLength(20); lastNameField.addValueChangeListener(event -> { String lastNameError = UserUtils.checkName(event.getValue()); if (!lastNameError.isEmpty()) { lastNameField.setComponentError(new UserError(lastNameError, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(lastNameError); saveButton.setEnabled(setError(lastNameField, true)); } else { lastNameField.setComponentError(null); saveButton.setEnabled(setError(lastNameField, false)); } }); setError(lastNameField, false); usernameField = new TextField(Language.get(Word.USERNAME)); usernameField.setValue(user.getUsername()); usernameField.setMaxLength(20); usernameField.addValueChangeListener(event -> { if (!event.getValue().equals(user.getUsername())) { String userNameError = UserUtils.checkUsername(event.getValue()); if (!userNameError.isEmpty()) { usernameField.setComponentError(new UserError(userNameError, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(userNameError); saveButton.setEnabled(setError(usernameField, true)); } else { usernameField.setComponentError(null); saveButton.setEnabled(setError(usernameField, false)); } } else { usernameField.setComponentError(null); saveButton.setEnabled(setError(usernameField, false)); } }); setError(usernameField, false); emailField = new TextField(Language.get(Word.EMAIL)); emailField.setValue(user.getEmail()); emailField.setMaxLength(256); emailField.addValueChangeListener(event -> { if (!event.getValue().equals(user.getEmail())) { String email1Error = UserUtils.checkEmail(event.getValue().toLowerCase()); if (!email1Error.isEmpty()) { emailField.setComponentError(new UserError(email1Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(email1Error); saveButton.setEnabled(setError(emailField, true)); } else { emailField.setComponentError(null); saveButton.setEnabled(setError(emailField, false)); } } else { emailField.setComponentError(null); saveButton.setEnabled(setError(emailField, false)); } }); setError(emailField, false); oldPasswordField = new PasswordField(Language.get(Word.OLD_PASSWORD)); oldPasswordField.setValue(""); oldPasswordField.setMaxLength(51); oldPasswordField.addValueChangeListener(event -> { if (!event.getValue().isEmpty()) { String password1Error = UserUtils.checkPassword(event.getValue()); if (!password1Error.isEmpty()) { oldPasswordField.setComponentError(new UserError(password1Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(password1Error); saveButton.setEnabled(setError(oldPasswordField, true)); } else { oldPasswordField.setComponentError(null); saveButton.setEnabled(setError(oldPasswordField, false)); } } else { oldPasswordField.setComponentError(null); saveButton.setEnabled(setError(oldPasswordField, false)); } }); setError(oldPasswordField, false); ProgressBar strength = new ProgressBar(); password1Field = new PasswordField(Language.get(Word.PASSWORD)); password1Field.setValue(""); password1Field.setMaxLength(51); password1Field.addValueChangeListener(event -> { if (!event.getValue().isEmpty()) { String password1Error = UserUtils.checkPassword(event.getValue()); strength.setValue(UserUtils.calculatePasswordStrength(event.getValue())); if (!password1Error.isEmpty()) { password1Field.setComponentError(new UserError(password1Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(password1Error); saveButton.setEnabled(setError(password1Field, true)); } else { password1Field.setComponentError(null); saveButton.setEnabled(setError(password1Field, false)); } } else { password1Field.setComponentError(null); saveButton.setEnabled(setError(password1Field, false)); } }); setError(password1Field, false); strength.setWidth("184px"); strength.setHeight("1px"); password2Field = new PasswordField(Language.get(Word.PASSWORD_AGAIN)); password2Field.setValue(""); password2Field.setMaxLength(51); password2Field.addValueChangeListener(event -> { if (!event.getValue().isEmpty()) { String password2Error = UserUtils.checkPassword(event.getValue()) + UserUtils.checkSecondPassword(password1Field.getValue(), event.getValue()); if (!password2Error.isEmpty()) { password2Field.setComponentError(new UserError(password2Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(password2Error); saveButton.setEnabled(setError(password2Field, true)); } else { password2Field.setComponentError(null); saveButton.setEnabled(setError(password2Field, false)); } } else { password2Field.setComponentError(null); saveButton.setEnabled(setError(password2Field, false)); } }); setError(password2Field, false); details.addComponents(firstNameField, lastNameField, usernameField, emailField, oldPasswordField, password1Field, strength, password2Field); return root; }