1

I have a pretty simple Vaadin Flow project for a college course setup with working login functionalities.

I know that the project automatically opens up to localhost:8080 in my default browser, but I am trying to get it to initially open to my login page to avoid getting routed to an error page.

I get around this to access my project by simply adding '/login' after the URL, but I was wondering where in my project I can have it open to 'localhost:8080/login' upon startup if this is even possible. Thanks!

WeekendJedi
  • 67
  • 10
  • 3
    The answer depends on whether you are using Spring Boot or not, and whether you use Spring Security or not. But in general the principle is that you will need to add before enter listener either in the main layout or set it in service init. You can then use beforeEvent.rerouteTo("login"); in the event to reroute the user to login. You probably need to check first if the user is logged in or not. – Tatu Lund Feb 22 '22 at 07:14
  • @TatuLund I am using Spring Boot but am not using Spring Security. I'll try adding some code in MainLayout.java that follows this guidance and see if I can get it. Thanks! – WeekendJedi Feb 22 '22 at 18:42

0 Answers0