fetch_api_key: Return `email` in json_response.

`/api/v1/fetch_api_key`'s response had a key `email` with the user's
delivery email. But its JSON counterpart `/json/fetch_api_key`, which
has a completely different implementation, did not return `email` in
its success response.

So to avoid confusion, the non-API endpoint, `/json/fetch_api_key`
response has been made identical with it's `/api` counterpart by
adding the `email` key. Also it is safe to send as the calling user
will only see their own email.
This commit is contained in:
orientor 2020-06-24 14:16:23 +05:30 committed by Tim Abbott
parent 2dd1ccef15
commit 8ab6182683
2 changed files with 2 additions and 1 deletions

View File

@ -4794,6 +4794,7 @@ components:
- $ref: '#/components/schemas/JsonSuccess'
- required:
- api_key
- email
- properties:
api_key:
type: string

View File

@ -946,7 +946,7 @@ def json_fetch_api_key(request: HttpRequest, user_profile: UserProfile,
return json_error(_("Your username or password is incorrect."))
api_key = get_api_key(user_profile)
return json_success({"api_key": api_key})
return json_success({"api_key": api_key, "email": user_profile.delivery_email})
@csrf_exempt
def api_fetch_google_client_id(request: HttpRequest) -> HttpResponse: