prepare(" INSERT INTO users (name, email, password_hash, role, two_factor_secret, two_factor_enabled, backup_codes) VALUES (?, ?, ?, 'ADMIN', ?, 1, ?) "); $stmt->execute([ $name, $email, $passwordHash, $secret, json_encode($backupCodes) ]); $adminId = (int)$db->lastInsertId(); // Automatische sessie starten $_SESSION['user_id'] = $adminId; $_SESSION['user_name'] = $name; $_SESSION['user_email'] = $email; $_SESSION['user_role'] = 'ADMIN'; $_SESSION['is_2fa_verified'] = true; unset($_SESSION['setup_totp_secret']); $success = true; } catch (Exception $e) { $error = "Fout bij aanmaken beheerder in MariaDB: " . $e->getMessage(); } } } $otpAuthUrl = TOTP::getOtpAuthUrl(!empty($email) ? $email : 'admin@fociz.local', $secret, 'Fociz'); $qrCodeUrl = TOTP::getQrCodeUrl($otpAuthUrl, 200); $pageTitle = "Fociz — Eerste Initialisatie"; ?> <?= htmlspecialchars($pageTitle) ?>

Fociz Initialisatie

Eenmalige configuratie van het hoofdbeheerdersaccount met verplichte 2FA

Beheerder Geïnstalleerd!

Uw account is aangemaakt en direct beveiligd met 2FA. Bewaar deze eenmalige herstelcodes veilig:

HERSTELCODES (NOODGEBRUIK):
Start met Fociz Dagplanning

Tweestapsverificatie (2FA) Koppelen

Scan onderstaande QR-code met uw authenticator app (Google Authenticator, Microsoft Authenticator of 1Password):

2FA QR Code
Sleutel: