mirror of https://github.com/zulip/zulip.git
Support api_key as well as api-key in authenticated_api_view.
All of our other API arguments use "_" as the delimiter, so we're migrating this to do that as well (except for the legacy send_message usage, which we're just hoping will eventually shrink to nothing). (imported from commit 40964cc08e0f94ba439a61e4f68ed500f74a554f)
This commit is contained in:
parent
91a08fc162
commit
c89c3443a8
|
@ -169,8 +169,13 @@ def authenticated_api_view(view_func):
|
|||
@require_post
|
||||
@has_request_variables
|
||||
@wraps(view_func)
|
||||
def _wrapped_view_func(request, email=REQ, api_key=REQ('api-key'),
|
||||
def _wrapped_view_func(request, email=REQ, api_key=REQ('api_key', default=None),
|
||||
api_key_legacy=REQ('api-key', default=None),
|
||||
*args, **kwargs):
|
||||
if not api_key and not api_key_legacy:
|
||||
raise RequestVariableMissingError("api_key")
|
||||
elif not api_key:
|
||||
api_key = api_key_legacy
|
||||
user_profile = validate_api_key(email, api_key)
|
||||
request.user = user_profile
|
||||
request._email = user_profile.email
|
||||
|
|
Loading…
Reference in New Issue