Error handling and routing for login screen