From a124db5f7ba57c552ca2db07dffcec25b784e415 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 9 Aug 2018 15:57:18 -0700 Subject: [PATCH] decorator: Check for deactivated realm before deactivated user. Structurally, this is the right order-of-access for data. --- zerver/decorator.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zerver/decorator.py b/zerver/decorator.py index 4c6718688b..1ce832a61c 100644 --- a/zerver/decorator.py +++ b/zerver/decorator.py @@ -231,11 +231,10 @@ def validate_api_key(request: HttpRequest, role: Optional[str], return user_profile def validate_account_and_subdomain(request: HttpRequest, user_profile: UserProfile) -> None: - if not user_profile.is_active: - raise JsonableError(_("Account not active")) - if user_profile.realm.deactivated: raise JsonableError(_("This organization has been deactivated")) + if not user_profile.is_active: + raise JsonableError(_("Account not active")) # Either the subdomain matches, or processing a websockets message # in the message_sender worker (which will have already had the