Skip to content

Commit c192072

Browse files
committed
fixed request object access and logic
1 parent e8abb5e commit c192072

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

oauth2_provider/views/base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ def get(self, request, *args, **kwargs):
116116

117117
# Check to see if the user has already granted access and return
118118
# a successful response
119-
require_approval = request.get('approval_prompt', 'auto') == 'auto'
120-
if not require_approval and request.user.accesstoken_set.filter(
121-
application=kwargs['application'],
122-
expires__gt=datetime.datetime.now()).count():
119+
require_approval = request.GET.get('approval_prompt', 'auto')
120+
if require_approval == 'auto' and request.user.accesstoken_set.filter(
121+
application=kwargs['application'],
122+
expires__gt=datetime.datetime.now()).count():
123123
uri, headers, body, status = self.create_authorization_response(
124-
request=self.request, scopes=" ".join(scopes),
125-
credentials=credentials, allow=True)
124+
request=self.request, scopes=" ".join(scopes),
125+
credentials=credentials, allow=True)
126126
self.success_url = uri
127127
return HttpResponseRedirect(self.success_url)
128128
return self.render_to_response(self.get_context_data(**kwargs))

0 commit comments

Comments
 (0)