sort out redirecting for log in and log out