|
@@ -80,14 +80,15 @@ class AuthView(View):
|
|
|
user_qs = GrantCodeModel.objects.filter(userID__userID=userID)
|
|
|
code = CommonService.encrypt_data(randomlength=32)
|
|
|
if client_id == '':
|
|
|
- application = ApplicationModel.objects.filter(grant_type="authorization_code")
|
|
|
+ application = ApplicationModel.objects.filter(redirect_uri=redirect_uri)
|
|
|
+ if application.exists():
|
|
|
+ application = ApplicationModel.objects.filter(grant_type="authorization_code")
|
|
|
else:
|
|
|
application = ApplicationModel.objects.filter(client_id=client_id)
|
|
|
if application.exists():
|
|
|
print(application.exists())
|
|
|
else:
|
|
|
return response.json(10005)
|
|
|
-
|
|
|
if redirect_uri == '':
|
|
|
pass
|
|
|
else:
|
|
@@ -112,7 +113,7 @@ class AuthView(View):
|
|
|
print('在修改')
|
|
|
user_qs.update(code=code, app_id=app_id, update_time=nowTime, expire_time=nowTime+3600)
|
|
|
if state == '':
|
|
|
- state = CommonService.encrypt_data(randomlength=4)
|
|
|
+ state = 'cHpi'
|
|
|
redirect_uri = application[0].redirect_uri + '?code=' + code + '&state=' + state
|
|
|
if application[0].skip_auth:
|
|
|
return HttpResponseRedirect(redirect_uri)
|