use of com.vaadin.flow.component.textfield.PasswordField in project Test-Bench-Data by DanielMartensson.
the class UserSettingsView method init.
@PostConstruct
public void init() {
// Create a text field, password field and a button
Select<String> selectedUser = new Select<String>(masterName, slaveName);
selectedUser.setLabel("Select user");
PasswordField newPassword = new PasswordField("New password");
Button save = new Button("Save new password");
// Add a listener to the button
save.addClickListener(e -> {
// Check if it's selected
if (selectedUser.isEmpty())
return;
// See if you have right to change the password
if (userPasswordService.loggedInUserIsMaster()) {
userPasswordService.changePassword(selectedUser.getValue(), newPassword.getValue());
Notification.show("Success!", 3000, Position.BOTTOM_START);
} else {
Notification.show("You don't have master rights to change password!", 3000, Position.BOTTOM_START);
}
});
add(selectedUser, newPassword, save);
}
use of com.vaadin.flow.component.textfield.PasswordField in project SODevelopment by syampillai.
the class SetMailSenderPassword method createPasswordField.
private PasswordField createPasswordField(String caption) {
PasswordField f = new PasswordField(caption);
f.setMaxLength(30);
return f;
}
use of com.vaadin.flow.component.textfield.PasswordField in project projecte-dam-v2-equip2 by IESEBRE.
the class RegisterView method initContent.
@Override
protected Component initContent() {
TextField username = new TextField("Nom");
EmailField email = new EmailField("Email");
PasswordField password1 = new PasswordField("Contrasenya");
PasswordField password2 = new PasswordField("Confirmar Contrasenya");
VerticalLayout register = new VerticalLayout(new H1("Crear usuari"), username, email, password1, password2, new Button("Crear", event -> register(username.getValue(), email.getValue(), password1.getValue(), password2.getValue())));
register.setAlignItems(Alignment.CENTER);
return register;
}
use of com.vaadin.flow.component.textfield.PasswordField in project flow-components by vaadin.
the class PasswordFieldTest method autoselectPropertyValue.
@Test
public void autoselectPropertyValue() {
PasswordField passwordField = new PasswordField();
assertAutoselectPropertyValueEquals(passwordField, true);
assertAutoselectPropertyValueEquals(passwordField, false);
}
use of com.vaadin.flow.component.textfield.PasswordField in project flow-components by vaadin.
the class PasswordFieldPage method addDisabledField.
private void addDisabledField() {
PasswordField passwordField = new PasswordField();
passwordField.setLabel("Password field label");
passwordField.setPlaceholder("placeholder text");
passwordField.setEnabled(false);
passwordField.setId("disabled-password-field");
Div message = new Div();
message.setId("disabled-password-field-message");
passwordField.addValueChangeListener(change -> message.setText("password changed"));
add(passwordField, message);
}
Aggregations