This commit is contained in:
Arthur TROUILLET 2022-03-29 11:52:40 +02:00
parent a26784cd98
commit 39e3859836
1 changed files with 3 additions and 0 deletions

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')