feat: Logout button

This commit is contained in:
filippo-ferrari 2024-07-15 23:12:49 +02:00
parent 03c20db830
commit 73f13934f9

View file

@ -3,6 +3,8 @@ package com.application.munera.views;
import com.vaadin.flow.component.html.H1;
import com.vaadin.flow.component.html.H2;
import com.vaadin.flow.component.login.LoginForm;
import com.vaadin.flow.component.login.LoginI18n;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.BeforeEnterEvent;
import com.vaadin.flow.router.BeforeEnterObserver;
@ -28,9 +30,18 @@ public class LoginView extends VerticalLayout implements BeforeEnterObserver {
login.setAction("login");
// Customize the LoginForm
LoginI18n i18n = LoginI18n.createDefault();
i18n.getForm().setForgotPassword("Forgot password?");
login.setI18n(i18n);
// Add a listener for the Forgot password button
login.addForgotPasswordListener(event -> {
Notification.show("Tough shit, feature aint ready yet!", 3000, Notification.Position.BOTTOM_CENTER);
});
add(new H1("Munera"), new H2("An expense tracking application"), login);
}
@Override
public void beforeEnter(BeforeEnterEvent beforeEnterEvent) {
if(beforeEnterEvent.getLocation()