From f46c791c4ec8f5b38328291aff878a625ebab1fa Mon Sep 17 00:00:00 2001 From: Roman Sebastian Karwacik <roman.karwacik@rwth-aachen.de> Date: Tue, 26 May 2020 16:23:36 +0200 Subject: [PATCH] If data is empty, the moodle_courses object should not be made, as the user should be promted to reauthenticate instead of stating that he is not in the course, which he maybe is --- l2pauth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l2pauth.py b/l2pauth.py index a975eb1..39c0ebf 100644 --- a/l2pauth.py +++ b/l2pauth.py @@ -66,9 +66,9 @@ def finish_oauth(): for course in l2pget('viewAllCourseInfo', token['access_token'])['dataSet']: session['l2p_courses'].append(course['uniqueid']) elif session['oauthscope'] == 'moodle': - session['moodle_courses'] = [] data = moodleget('getmyenrolledcourses', token['access_token']) if data and data.get('Data'): + session['moodle_courses'] = [] for course in data['Data']: session['moodle_courses'].append(str(course['id'])) else: -- GitLab