Skip to content

Instantly share code, notes, and snippets.

@thomwiggers
Created December 19, 2016 21:14
Show Gist options
  • Save thomwiggers/404d975ee99fa5aa6500c9ccc8bc1072 to your computer and use it in GitHub Desktop.
Save thomwiggers/404d975ee99fa5aa6500c9ccc8bc1072 to your computer and use it in GitHub Desktop.
@sensitive_variables()
@sensitive_post_parameters()
@require_POST
@csrf_exempt
def wiki_login(request):
apikey = request.POST.get('apikey')
user = request.POST.get('user')
password = request.POST.get('password')
if apikey != settings.WIKI_API_KEY:
return HttpResponseForbidden('{"status":"error","msg":"invalid key"}')
if user is None or password is None:
return HttpResponseBadRequest(
'{"status":"error","msg":"Missing username or password"}',
content_type='application/json')
raise Exception('derp')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment