Logging and redirecting to home if not logged in