<?php
require_once __DIR__ . '/../app/bootstrap.php';

use App\Core\Auth;

if ($_SERVER['REQUEST_METHOD'] !== 'POST' || !verify_csrf()) {
    http_response_code(405);
    header('Allow: POST');
    redirect(Auth::check() ? role_dashboard_url() : 'public/login.php');
}
Auth::logout();
redirect('public/login.php');
