From 168a4126d3fd43f0d6f5aa6a7303c867a4a25302 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 2 Feb 2026 16:51:56 +0000 Subject: [PATCH] Refactor exam start template for improved readability and URL handling --- sbas/templates/sbas/exam_start.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sbas/templates/sbas/exam_start.html b/sbas/templates/sbas/exam_start.html index 20515f2e..e4febcd4 100755 --- a/sbas/templates/sbas/exam_start.html +++ b/sbas/templates/sbas/exam_start.html @@ -2,7 +2,7 @@ {% block content %} -

Start exam: {{exam}}

+

Start exam: {{ exam }}

{% if exam.time_limit %} This exam has a time limit of {{ exam.get_time_limit }}. The time will start when you click the Start Exam button below.
@@ -44,7 +44,10 @@ let passcode = $("#passcode-box").val(); if (Number.isInteger(parseInt(cid))) { - window.location.replace("{% url 'sbas:exam_take' pk=exam.pk sk=0 cid='0000000' passcode='ZZZZZZ' %}".replace("0000000", cid).replace("ZZZZZZ", passcode)); + // reverse a URL with safe placeholders and replace them client-side + const template = "{% url 'sbas:exam_take' pk=exam.pk sk=0 cid=0 passcode='0' %}"; // e.g. /sbas/exam/1/0/0/0/take + const url = template.replace('/0/0/take', `/${cid}/${passcode}/take`); + window.location.replace(url); } else { alert("Please enter a valid Candidate ID (CID).") }