validate_api_key: Stop using 'profile' local variable.

This commit is contained in:
Tim Abbott 2017-08-14 15:59:57 -07:00
parent 25ec30dcf1
commit 5d2d939310
1 changed files with 3 additions and 3 deletions

View File

@ -195,11 +195,11 @@ def validate_api_key(request, role, api_key, is_webhook=False):
raise JsonableError(_("This API key only works on the root subdomain"))
return remote_server
profile = access_user_by_api_key(request, api_key, email=role)
if profile.is_incoming_webhook and not is_webhook:
user_profile = access_user_by_api_key(request, api_key, email=role)
if user_profile.is_incoming_webhook and not is_webhook:
raise JsonableError(_("This API is not available to incoming webhook bots."))
return profile
return user_profile
def access_user_by_api_key(request, api_key, email=None):
# type: (HttpRequest, Text, Optional[Text]) -> UserProfile