Code reorganization.
Login
Logout
If not logged in, redirect to login