Hi guys,
My name is Harrison and I am new to Vaadin. I am here to ask for some advices. Thanks so much in advance.
I am now trying to create a login function in Vaadin. When login, I just pass the username as a parameter in navigateTo() method to a dashboard view, like this:
getUI().getNavigator().navigateTo(DashBoard.NAME + "/" + email.getValue());
and then the dashboard view gets the parameter. I guess this is not a real login, right? And the result of this “ugly login” is that, when I logout, I am using these code:
logout.addClickListener(e -> {
getUI().getSession().close();
getUI().getNavigator().navigateTo(LoginForm.NAME);
});
It will redirect to LoginFrom view and if I click the “back” button on browser, it will show session expired. BUT if I click refresh at that time, the page will go back to the dashboard view with the username parameter, which means it becomes “logged in” again. I hope this make sense.
So my question is. what is a correct login mechanism when using Vaadin 8. Or if anyone has created a similar login app and willing to share to me for me to learn, i really really appreciate that.
Also, I wonder what is a best way to create a forgot/reset password function. The app will send a link to email, and after click the link, the user will be direct to a view based on the parameter on that link. This is easy to be done when using javaee servlet, but I dont know the vaadin way. Thanks so so much. Thanks in advance.
Best,
Harrison