mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
feat: student mode support for thanks page (admin-auth only)
- add hidden student_mode field in add.php form - pass mode=student through redirect to thanks.php in formulaire.php - thanks.php renders clean student thank-you page (no header, centered button) - add CSS for .thanks-student-page, .btn-new-form, .thanks-success, .thanks-error - admin auth always required; student mode is purely UI variant on the physical machine
This commit is contained in:
@@ -9,6 +9,8 @@ ini_set('error_log', 'error.log');
|
||||
|
||||
AdminAuth::requireLogin();
|
||||
|
||||
$studentMode = isset($_POST['student_mode']) && $_POST['student_mode'] === '1';
|
||||
|
||||
// Verify CSRF token
|
||||
if (!isset($_POST['csrf_token'], $_SESSION['csrf_token'])
|
||||
|| !hash_equals($_SESSION['csrf_token'], $_POST['csrf_token'])) {
|
||||
@@ -26,7 +28,11 @@ try {
|
||||
|
||||
unset($_SESSION['csrf_token']);
|
||||
|
||||
header('Location: ../thanks.php?id=' . urlencode($thesisId));
|
||||
$redirect = '../thanks.php?id=' . urlencode($thesisId);
|
||||
if ($studentMode) {
|
||||
$redirect .= '&mode=student';
|
||||
}
|
||||
header('Location: ' . $redirect);
|
||||
exit();
|
||||
|
||||
} catch (Exception $e) {
|
||||
@@ -35,11 +41,16 @@ try {
|
||||
App::flash('error', $e->getMessage());
|
||||
$_SESSION['form_data'] = $_POST;
|
||||
|
||||
$redirect = '../add.php';
|
||||
if ($studentMode) {
|
||||
$redirect .= '?mode=student';
|
||||
}
|
||||
|
||||
$autofocusField = ThesisCreateController::autofocusFieldForError($e->getMessage());
|
||||
if ($autofocusField !== null) {
|
||||
App::flashAutofocus($autofocusField);
|
||||
}
|
||||
|
||||
header('Location: ../add.php');
|
||||
header('Location: ' . $redirect);
|
||||
exit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user