2b9a673912
PHP registration page for AzerothCore with SRP6 salt/verifier generation, Cloudflare Turnstile + honeypot + rate limiting anti-spam, and a WoW-themed landing page with client setup instructions.
114 lines
4.0 KiB
PHP
114 lines
4.0 KiB
PHP
<?php
|
||
declare(strict_types=1);
|
||
|
||
$config = require __DIR__ . '/../includes/bootstrap.php';
|
||
|
||
$errors = $_SESSION['flash_errors'] ?? [];
|
||
$old = $_SESSION['flash_old'] ?? [];
|
||
$success = $_SESSION['flash_success'] ?? null;
|
||
unset($_SESSION['flash_errors'], $_SESSION['flash_old'], $_SESSION['flash_success']);
|
||
|
||
$siteKey = htmlspecialchars($config['turnstile']['site_key'], ENT_QUOTES);
|
||
$token = csrf_token();
|
||
?>
|
||
<!DOCTYPE html>
|
||
<html lang="cs">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Registrace účtu — WoW server</title>
|
||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||
<link href="https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Cinzel+Decorative:wght@700&family=EB+Garamond:ital,wght@0,400;0,600;1,400&display=swap" rel="stylesheet">
|
||
<link rel="stylesheet" href="assets/style.css">
|
||
<?php if ($siteKey !== ''): ?>
|
||
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
|
||
<?php endif; ?>
|
||
</head>
|
||
<body>
|
||
<div class="frame">
|
||
<main class="card">
|
||
<a class="back-link" href="index.php">← Zpět na úvod</a>
|
||
<div class="crest" aria-hidden="true"></div>
|
||
<h1>Registrace účtu</h1>
|
||
<div class="divider"><span>⚔</span></div>
|
||
|
||
<?php if ($success): ?>
|
||
<div class="alert alert-success">
|
||
<?= htmlspecialchars($success, ENT_QUOTES) ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($errors)): ?>
|
||
<div class="alert alert-error">
|
||
<ul>
|
||
<?php foreach ($errors as $error): ?>
|
||
<li><?= htmlspecialchars($error, ENT_QUOTES) ?></li>
|
||
<?php endforeach; ?>
|
||
</ul>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!$success): ?>
|
||
<form method="post" action="register.php" autocomplete="off">
|
||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($token, ENT_QUOTES) ?>">
|
||
|
||
<!-- Honeypot: skryté před lidmi přes CSS, boti pole často vyplní -->
|
||
<div class="hp-field" aria-hidden="true">
|
||
<label for="website">Nechte prázdné</label>
|
||
<input type="text" id="website" name="website" tabindex="-1" autocomplete="off">
|
||
</div>
|
||
|
||
<label for="username">Uživatelské jméno</label>
|
||
<input
|
||
type="text"
|
||
id="username"
|
||
name="username"
|
||
minlength="<?= (int) $config['rules']['username_min'] ?>"
|
||
maxlength="<?= (int) $config['rules']['username_max'] ?>"
|
||
value="<?= htmlspecialchars($old['username'] ?? '', ENT_QUOTES) ?>"
|
||
required
|
||
>
|
||
<p class="hint">Pouze písmena A-Z a číslice, <?= (int) $config['rules']['username_min'] ?>–<?= (int) $config['rules']['username_max'] ?> znaků.</p>
|
||
|
||
<label for="email">E-mail</label>
|
||
<input
|
||
type="email"
|
||
id="email"
|
||
name="email"
|
||
value="<?= htmlspecialchars($old['email'] ?? '', ENT_QUOTES) ?>"
|
||
required
|
||
>
|
||
|
||
<label for="password">Heslo</label>
|
||
<input
|
||
type="password"
|
||
id="password"
|
||
name="password"
|
||
minlength="<?= (int) $config['rules']['password_min'] ?>"
|
||
maxlength="<?= (int) $config['rules']['password_max'] ?>"
|
||
required
|
||
>
|
||
|
||
<label for="password_confirm">Heslo znovu</label>
|
||
<input
|
||
type="password"
|
||
id="password_confirm"
|
||
name="password_confirm"
|
||
minlength="<?= (int) $config['rules']['password_min'] ?>"
|
||
maxlength="<?= (int) $config['rules']['password_max'] ?>"
|
||
required
|
||
>
|
||
|
||
<?php if ($siteKey !== ''): ?>
|
||
<div class="cf-turnstile" data-sitekey="<?= $siteKey ?>"></div>
|
||
<?php endif; ?>
|
||
|
||
<button type="submit"><span>Zaregistrovat se</span></button>
|
||
</form>
|
||
<?php endif; ?>
|
||
</main>
|
||
</div>
|
||
</body>
|
||
</html>
|