Add 42Oauth #37

Merged
Danhia merged 5 commits from :main into 42OAuth 2022-03-29 19:51:57 +02:00
1 changed files with 3 additions and 0 deletions
Showing only changes of commit 39e3859836 - Show all commits

View File

@ -54,7 +54,10 @@ def authorize_intra42(request):
response = oauth_intra42.intra42.get('v2/me', token=token) response = oauth_intra42.intra42.get('v2/me', token=token)
response = response.json() response = response.json()
intra42_id = response['id'] intra42_id = response['id']
intra42_campus = response['campus'][0]['name']
print(intra42_campus)
request.user.userprofileinfo.intra42_id = intra42_id request.user.userprofileinfo.intra42_id = intra42_id
request.user.userprofileinfo.intra42_campus = intra42_campus
request.user.userprofileinfo.save() request.user.userprofileinfo.save()
return redirect('accounts:edit') return redirect('accounts:edit')