Skip to main content

verify_enrolled

Function verify_enrolled 

Source
async fn verify_enrolled(
    conn: &mut PgConnection,
    user_id: Uuid,
    course_id: Uuid,
) -> Result<(), ControllerError>
Expand description

Rejects a user who is not enrolled on the exercise’s course.

The shared submit domain fn reports a not-enrolled user as 401 Unauthorized, but the editor client treats 401 as an invalid token and deletes the stored credentials, logging the student out on their first submit. 422 not_enrolled lets the client prompt for enrollment instead.