Commit 445873cf authored by Martin Lehoux's avatar Martin Lehoux

bad personType

parent 9747d008
......@@ -4,14 +4,14 @@ import requests
def find_or_create_user(access_token, access_token_payload):
data = access_token_payload['user']
if data['personType'] not in ['STUDENT_SUPELEC', 'STUDENT_CENTRALE', 'STUDENT_CENTRALESUPELEC']:
raise Exception('Permission denied')
try:
user = User.objects.get(username=data['login'])
except User.DoesNotExist:
data = requests.get("https://auth.viarezo.fr/api/user/show/me", headers={
'Authorization': "Bearer {access_token}".format(access_token=access_token)
}).json()
if data['personType'] not in ['STUDENT_SUPELEC', 'STUDENT_CENTRALE', 'STUDENT_CENTRALESUPELEC']:
raise Exception('Permission denied')
user = User(
username=data['login'],
first_name=data['firstName'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment