When handling the login and logout routes, redirect to the profile or home page afterwards