Thomas Johansson avatar Thomas Johansson committed 91ecfa7

Should use HttpResponseBadRequest here, not HttpResponseForbidden.

Comments (0)

Files changed (1)

piston/authentication/oauth/views.py

 import oauth2 as oauth
 from django.contrib.auth.decorators import login_required
-from django.http import HttpResponse, HttpResponseForbidden, HttpResponseRedirect
+from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseRedirect
 from django.shortcuts import render_to_response
 from django.template import RequestContext
 from django.views.decorators.csrf import csrf_exempt
 
     # Ensure the client is using 1.0a
     if 'oauth_callback' not in oauth_request:
-        return HttpResponseForbidden('OAuth 1.0 is not supported, you must use OAuth 1.0a.')
+        return HttpResponseBadRequest('OAuth 1.0 is not supported, you must use OAuth 1.0a.')
 
     if not verify_oauth_request(request, oauth_request, consumer):
-        return HttpResponseForbidden('Invalid request')
+        return HttpResponseBadRequest()
 
     request_token = store.create_request_token(request, oauth_request, consumer, oauth_request['oauth_callback'])
     ret = 'oauth_token=%s&oauth_token_secret=%s&callback_confirmed=true' % (request_token.key, request_token.secret)
     request_token = store.get_request_token(request, oauth_request, oauth_request['oauth_token'])
 
     if not verify_oauth_request(request, oauth_request, consumer, request_token):
-        return HttpResponseForbidden('Invalid request')
+        return HttpResponseBadRequest()
         
     if oauth_request.get('oauth_verifier', None) != request_token.verifier:
         return False
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.