1e51ef7def
- Konzept/, didaktik_geografie/, didaktik_simulation/, v2-modules/, v2-platform/ - 12 code-workspace-Files - STATUS-*.md - viele M/D/R-Änderungen an bereits getrackten Files - .gitignore verstärkt: **/.humaninput/, **/secret_keys.txt Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
28 lines
814 B
PHP
28 lines
814 B
PHP
<?php
|
|
/**
|
|
* POST /api/auth/logout
|
|
*
|
|
* Wir nutzen stateless JWT — server-seitig gibt's nichts zu löschen.
|
|
* Klient löscht das Token aus LocalStorage. Endpoint loggt nur den
|
|
* Logout in activity_log und antwortet 200.
|
|
*
|
|
* (Bei späterer Token-Blacklist-Einführung: hier eintragen.)
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
require_once __DIR__ . '/../../bootstrap.php';
|
|
|
|
v2_validate_method('POST');
|
|
$payload = v2_auth_current();
|
|
if ($payload) {
|
|
try {
|
|
$userType = ($payload['role'] === 'student') ? 'student' : 'teacher';
|
|
v2_db_exec(
|
|
"INSERT INTO activity_log (user_type, user_id, action) VALUES (:t, :id, 'v2_logout')",
|
|
[':t' => $userType, ':id' => (int) ($payload['sub'] ?? 0)]
|
|
);
|
|
} catch (Throwable $e) { /* optional */ }
|
|
}
|
|
|
|
v2_response_ok(['ok' => true]);
|