Hello,
I wanted to ask how to create a secure login.
I have only one login view so far and wanted to ask now how I can change the view after successful login. The login check via a MySQL database also runs without problems. I just don’t want that someone just add “dashboard” in the url and skip the login.
@Route("login")
@PageTitle("Login")
public class LoginView extends VerticalLayout {
private final LoginService loginService;
private LoginOverlay loginOverlay = new LoginOverlay();
public LoginView(LoginService loginService) {
this.loginService = loginService;
this.loginOverlay.setOpened(true);
this.loginOverlay.setForgotPasswordButtonVisible(false);
this.loginOverlay.setDescription(null);
this.loginOverlay.setEnabled(true);
this.loginOverlay.addLoginListener(e -> {
if (this.loginService.authenticateUser(e.getUsername(), e.getPassword())) {
?
} else {
this.loginOverlay.setError(true);
}
});
this.add(loginOverlay);
}
}