Make POST /indie/auth return a 403 if parameters are missing, rather than a 500
This commit is contained in:
parent
d87d49e67b
commit
bfa7f68edc
1 changed files with 5 additions and 5 deletions
|
@ -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…
Reference in a new issue