Logout view and better error handling for register and login view