feat: add full-screen exam delivery UI with JWT auth fix
- Fix jwt_required decorator to set request.env user context via update_env() instead of passing user as kwarg (fixes null student_id on attempt creation for auth='none' API routes) - Build standalone exam session page with timer, question navigator, auto-save, and instant score display (no dependency on web.frontend_layout) - Add exam_delivery.js for client-side exam interaction (MCQ selection, section navigation, countdown, autosave, submit & results) - Generate per-session JWT in controller for API calls from the exam page Made-with: Cursor
This commit is contained in:
@@ -70,13 +70,14 @@ def validate_token():
|
||||
|
||||
|
||||
def jwt_required(func):
|
||||
"""Decorator that validates the JWT token and injects the user as first arg."""
|
||||
"""Decorator that validates the JWT token and sets request.env user context."""
|
||||
@functools.wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
user = validate_token()
|
||||
if not user:
|
||||
return _error_response("Authentication required", status=401)
|
||||
return func(*args, user=user, **kwargs)
|
||||
request.update_env(user=user.id)
|
||||
return func(*args, **kwargs)
|
||||
return wrapper
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user