I have created 2 html pages and 2 GWT modules. The first page is a login page. If the login is successful, i open the second page with Window.Location.assign(“URL”).
I can still open the second webpage without logging in just by typing the correct URL in the browser.
How to prevent this second page from displaying if user is not logged in?
This is best done using server side technology (it’s up to you which one you choose, Java EE is the only one I’m really familiar with, and it’s almost trivial if you use that).
Alternatively, if what you’re building is very Javascript heavy (you’re using GWT after all), you could always add some Javascript on the second page to detect if the user is logged in, and redirect them to the first (login) page if they are not. This is far less robust though.