Skip to content

Commit 065fc93

Browse files
committed
status
1 parent a0ba1d3 commit 065fc93

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

apps/dot_ext/views/authorization.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import waffle
77
from waffle import get_waffle_flag_model
88

9-
from django.http.response import HttpResponse, HttpResponseBadRequest
9+
from django.http.response import HttpResponse, HttpResponseBadRequest, JsonResponse
1010
from django.template.response import TemplateResponse
1111
from django.utils.decorators import method_decorator
1212
from django.views.decorators.csrf import csrf_exempt
@@ -21,6 +21,7 @@
2121
)
2222
from oauth2_provider.models import get_application_model
2323
from oauthlib.oauth2.rfc6749.errors import InvalidClientError, InvalidGrantError
24+
from rest_framework import status as http_status
2425
from urllib.parse import urlparse, parse_qs
2526
import html
2627
from apps.dot_ext.scopes import CapabilitiesScopes
@@ -184,7 +185,20 @@ def form_valid(self, form):
184185
refresh_token_delete_cnt) = remove_application_user_pair_tokens_data_access(application, self.request.user)
185186

186187
if not scopes:
187-
return self.error_response("No scopes", application)
188+
beneficiary_authorized_application.send(
189+
sender=self,
190+
request=self.request,
191+
auth_status="FAIL",
192+
auth_status_code=http_status.HTTP_400_BAD_REQUEST,
193+
user=self.request.user,
194+
application=application,
195+
share_demographic_scopes=share_demographic_scopes,
196+
scopes=scopes,
197+
allow=allow,
198+
access_token_delete_cnt=access_token_delete_cnt,
199+
refresh_token_delete_cnt=refresh_token_delete_cnt,
200+
data_access_grant_delete_cnt=data_access_grant_delete_cnt)
201+
return JsonResponse({"error": 'The state parameter is required'}, status=http_status.HTTP_400_BAD_REQUEST)
188202
try:
189203
uri, headers, body, status = self.create_authorization_response(
190204
request=self.request, scopes=scopes, credentials=credentials, allow=allow

0 commit comments

Comments
 (0)