From eb6208c5dccfc3e617728cfcd41fb9d505198293 Mon Sep 17 00:00:00 2001 From: Ross Date: Sun, 12 Dec 2021 17:02:27 +0000 Subject: [PATCH] . --- generic/views.py | 1 + longs/views.py | 3 +++ rapids/views.py | 3 +++ 3 files changed, 7 insertions(+) diff --git a/generic/views.py b/generic/views.py index 6cf64ab8..f8a69a28 100644 --- a/generic/views.py +++ b/generic/views.py @@ -645,6 +645,7 @@ class ExamViews(View, LoginRequiredMixin): "json_creation_time": creation_time, "exam_json_id": exam.exam_json_id, "exam_active": exam.active, + "exam_mode": exam.exam_mode, } if self.question_type == "long": diff --git a/longs/views.py b/longs/views.py index 37f788a0..4d24b82f 100755 --- a/longs/views.py +++ b/longs/views.py @@ -634,6 +634,9 @@ def loadJsonAnswer(answer): exam = get_object_or_404(Exam, pk=eid) + if not exam.check_cid_user(answer["cid"], answer["passcode"]): + return False, JsonResponse({"success": False, "error": "invalid cid / passcode"}) + # if not exam.active: # return False, JsonResponse( # {"success": False, "error": "No active exam: {}".format(eid)} diff --git a/rapids/views.py b/rapids/views.py index a02271f1..16520fda 100755 --- a/rapids/views.py +++ b/rapids/views.py @@ -525,6 +525,9 @@ def loadJsonAnswer(answer): exam = get_object_or_404(Exam, pk=eid) + if not exam.check_cid_user(answer["cid"], answer["passcode"]): + return False, JsonResponse({"success": False, "error": "invalid cid / passcode"}) + # if not exam.active: # return False, JsonResponse( # {"success": False, "error": "No active exam: {}".format(eid)}