mirror of https://github.com/zulip/zulip.git
Fix users in deactivated realms sending webhook messages.
In a deactivated realm, webhooks would still successfully send messages, since there was no check for whether the realm was active in api_key_only_webhook_view.
This commit is contained in:
parent
9da73b22d3
commit
b31ac1eca9
|
@ -172,9 +172,13 @@ def api_key_only_webhook_view(view_func):
|
|||
*args, **kwargs):
|
||||
|
||||
try:
|
||||
user_profile = UserProfile.objects.get(api_key=api_key, is_active=True)
|
||||
user_profile = UserProfile.objects.get(api_key=api_key)
|
||||
except UserProfile.DoesNotExist:
|
||||
raise JsonableError("Invalid API key")
|
||||
if not user_profile.is_active:
|
||||
raise JsonableError("Account not active")
|
||||
if user_profile.realm.deactivated:
|
||||
raise JsonableError("Realm for account has been deactivated")
|
||||
|
||||
request.user = user_profile
|
||||
request._email = user_profile.email
|
||||
|
|
Loading…
Reference in New Issue