Verified Commit 2bd71c9d authored by Hugo Kerstens's avatar Hugo Kerstens
Browse files

Reject signature validation for unstructured exams

parent c292065d
......@@ -112,9 +112,9 @@ class CheckStudents extends React.Component {
.catch(err => {
Notification.error('failed to put submission (see javascript console for details)')
console.error('failed to put submission:', err)
throw err
err.json().then(res => {
Notification.error(`Failed to validate copy: ${res.message}`)
......@@ -4,7 +4,7 @@ from flask import current_app as app
from flask_restful import Resource, reqparse
from pdfrw import PdfReader
from ..database import db, Exam, Submission, Student, Copy, Solution
from ..database import db, Exam, Submission, Student, Copy, Solution, ExamLayout
def copy_to_data(copy):
......@@ -79,6 +79,9 @@ class Copies(Resource):
if (exam := Exam.query.get(exam_id)) is None:
return dict(status=404, message='Exam does not exist.'), 404
if exam.layout == ExamLayout.unstructured:
return dict(status=403, message='Signatures cannot be validated for unstructured exams.'), 403
if (copy := Copy.query.filter(Copy.number == copy_number,
Copy.exam == exam).one_or_none()) is None:
return dict(status=404, message='Copy does not exist.'), 404
Supports Markdown
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