User session handling and redirecting