70 lines
3.4 KiB
HTML
70 lines
3.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="ru">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Регистрация — CS2 Simulator</title>
|
|
<link rel="stylesheet" href="/static/css/style.css">
|
|
</head>
|
|
<body>
|
|
<nav class="navbar">
|
|
<div class="container">
|
|
<a href="/" class="logo">CS2 <span>Simulator</span></a>
|
|
<button class="mobile-toggle" id="mobileToggle">☰</button>
|
|
<div class="nav-links" id="navLinks">
|
|
<button onclick="toggleSafeMode()" class="btn btn-ghost" id="safeModeToggle" title="Режим записи">🎙️</button>
|
|
<a href="/login" class="btn btn-outline">Войти</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<main style="display:flex;align-items:center;justify-content:center;min-height:calc(100vh - 60px);padding:2rem 1rem;">
|
|
<div class="card" style="max-width:400px;width:100%;padding:2rem;">
|
|
<h1 class="display-font" style="font-size:1.3rem;margin-bottom:0.25rem;text-align:center;">Регистрация</h1>
|
|
<p class="text-dim text-sm text-center" style="margin-bottom:1.5rem;">Создайте новый аккаунт</p>
|
|
|
|
<form id="registerForm">
|
|
<div class="form-group">
|
|
<label class="form-label">Имя пользователя</label>
|
|
<input type="text" id="username" name="username" class="form-input" required minlength="3">
|
|
<div class="form-hint">Минимум 3 символа</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label">Пароль</label>
|
|
<input type="password" id="password" name="password" class="form-input" required minlength="4">
|
|
<div class="form-hint">Минимум 4 символа</div>
|
|
</div>
|
|
<div id="errorMessage" class="form-error" style="display:none;margin-bottom:0.75rem;"></div>
|
|
<button type="submit" class="btn btn-primary btn-block btn-large">Зарегистрироваться</button>
|
|
</form>
|
|
|
|
<p class="text-dim text-sm text-center" style="margin-top:1rem;">
|
|
Уже есть аккаунт? <a href="/login" style="color:var(--primary);">Войдите</a>
|
|
</p>
|
|
</div>
|
|
</main>
|
|
|
|
<script>
|
|
document.getElementById('registerForm').addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
const formData = new FormData(e.target);
|
|
const errorDiv = document.getElementById('errorMessage');
|
|
try {
|
|
const response = await fetch('/web/api/auth/register', { method: 'POST', body: formData });
|
|
const data = await response.json();
|
|
if (response.ok && data.success) {
|
|
window.location.href = data.redirect;
|
|
} else {
|
|
errorDiv.textContent = data.error || 'Ошибка регистрации';
|
|
errorDiv.style.display = 'block';
|
|
}
|
|
} catch (error) {
|
|
errorDiv.textContent = 'Ошибка соединения с сервером';
|
|
errorDiv.style.display = 'block';
|
|
}
|
|
});
|
|
</script>
|
|
<script src="/static/js/safemode.js"></script>
|
|
</body>
|
|
</html>
|