'how to get username and password entered in vaadin flow LoginForm?

How to get username and password entered in vaadin flow LoginForm? I know it is from e, but how?

If this is not possible how can I extend the LoginForm and modify the authenticate(e) method?

    LoginForm component = new LoginForm();
component.addLoginListener(e -> {
    boolean isAuthenticated = authenticate(e);
    if (isAuthenticated) {
        navigateToMainPage();
    } else {
        component.setError(true);
    }
});

add(component);


Solution 1:[1]

Use the following:

e.getUsername()

Solution 2:[2]

e ist a AbstractLogin.LoginEvent that has a getUsername() and a getPassword() Methode.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vinzee
Solution 2 Sascha Frinken