Files
pagedev.pl/views/verify.php
2026-01-29 21:08:01 +01:00

79 lines
4.1 KiB
PHP

<?php
$pageTitle = 'Weryfikacja 2FA - System 2FA';
$bodyClass = 'bg-gradient-primary';
$extraHead = '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">';
ob_start();
?>
<div class="container">
<div class="row justify-content-center align-items-center min-vh-100">
<div class="col-xl-10 col-lg-12 col-md-9">
<div class="card o-hidden border-0 shadow-lg my-5">
<div class="card-body p-0">
<div class="row">
<div class="col-lg-6 d-none d-lg-block bg-verify-image"></div>
<div class="col-lg-6">
<div class="p-5">
<div class="text-center">
<h1 class="h4 text-gray-900 mb-2">Weryfikacja dwuskładnikowa</h1>
<p class="mb-4 text-muted">Wprowadź kod weryfikacyjny</p>
</div>
<?php if (isset($_SESSION['error'])): ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<?php
echo htmlspecialchars($_SESSION['error']);
unset($_SESSION['error']);
?>
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
<?php endif; ?>
<div class="alert alert-info" role="alert">
<i class="fas fa-info-circle"></i>
<strong>Tryb testowy:</strong> Kod weryfikacyjny znajduje się w konsoli przeglądarki (F12).
</div>
<form class="user" method="POST" action="/weryfikuj-kod">
<div class="form-group mb-3">
<input type="text" class="form-control form-control-user text-center"
id="code" name="code"
placeholder="000000"
maxlength="6"
pattern="[0-9]{6}"
required autofocus>
<small class="form-text text-muted">Wprowadź 6-cyfrowy kod</small>
</div>
<button type="submit" class="btn btn-primary btn-user btn-block w-100">
Zweryfikuj
</button>
</form>
<hr>
<div class="text-center">
<a href="/logowanie" class="small">Powrót do logowania</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
$content = ob_get_clean();
$extraScript = '<script>
// Wyświetlanie kodu weryfikacyjnego w konsoli (tylko dla testów)
' . (isset($_SESSION['test_code']) ? "console.log('%c🔐 KOD WERYFIKACYJNY: " . $_SESSION['test_code'] . "', 'background: #222; color: #bada55; font-size: 20px; padding: 10px;');\n console.log('W produkcji kod zostałby wysłany emailem.');" : '') . '
// Auto-focus i formatowanie pola kodu
document.getElementById("code").addEventListener("input", function() {
this.value = this.value.replace(/[^0-9]/g, "");
});
</script>';
require __DIR__ . '/layout.php';
?>