<?php

declare(strict_types=1);

require_once __DIR__ . '/app/core/auth.php';
require_once __DIR__ . '/app/core/csrf.php';

if (is_post()) {
    require_valid_csrf();
    logout_user();
    flash('success', ['type' => 'success', 'message' => 'You have been signed out.']);
    redirect('login.php');
}

redirect(is_logged_in() ? 'dashboard.php' : 'login.php');
