Browse Source

Make POST /indie/auth return a 403 if parameters are missing, rather than a 500

pull/1/head
Danielle McLean 4 years ago
parent
commit
bfa7f68edc
Signed by: 00dani GPG Key ID: 5A5D2D1AFF12EEC5
  1. 10
      lemonauth/views/indie.py

10
lemonauth/views/indie.py

@ -77,14 +77,14 @@ class IndieView(TemplateView):
post = request.POST.dict()
try:
code = IndieAuthCode.objects.get(
code=post['code'],
client_id=post['client_id'],
redirect_uri=post['redirect_uri']
code=post.get('code'),
client_id=post.get('client_id'),
redirect_uri=post.get('redirect_uri'),
)
except IndieAuthCode.DoesNotExist:
return HttpResponseForbidden(
'invalid auth code {0}'.format(post['code']),
content_type='text/plain'
'invalid parameters',
content_type='text/plain',
)
code.delete()
return utils.choose_type(request, {'me': code.me}, {

Loading…
Cancel
Save