55 lines
2.1 KiB
HTML
55 lines
2.1 KiB
HTML
<?php
|
||
/**
|
||
* @package Bicycle
|
||
* @description index.html — главная страница = вход. Без общего layout: пока единственная страница проекта, своя HTML-обвязка прямо тут.
|
||
*
|
||
* @var string|null $error Сообщение об ошибке (неверные данные)
|
||
* @var array|null $user Текущий авторизованный пользователь (без пароля), null — гость
|
||
*/
|
||
|
||
use System\Classes\CSRF;
|
||
|
||
?>
|
||
<!DOCTYPE html>
|
||
<html lang="ru">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Бюджет</title>
|
||
<link rel="stylesheet" href="/vendor/twbs/bootstrap/dist/css/bootstrap.min.css">
|
||
</head>
|
||
<body class="d-flex align-items-center justify-content-center bg-body-secondary" style="min-height: 100vh;">
|
||
<div class="card shadow-sm" style="width: 100%; max-width: 400px;">
|
||
<div class="card-body p-4">
|
||
<h1 class="h3 mb-3">Вход</h1>
|
||
|
||
<?php if ($user !== null): ?>
|
||
<p>Вы вошли как <strong><?= htmlspecialchars($user['login'], ENT_QUOTES, 'UTF-8') ?></strong>.</p>
|
||
<?php else: ?>
|
||
<?php if ($error !== null): ?>
|
||
<div class="alert alert-danger"><?= htmlspecialchars($error, ENT_QUOTES, 'UTF-8') ?></div>
|
||
<?php endif; ?>
|
||
|
||
<form method="post" action="/">
|
||
<?= CSRF::field() ?>
|
||
|
||
<div class="mb-3">
|
||
<label class="form-label">Логин
|
||
<input type="text" name="login" class="form-control" autocomplete="username" autofocus>
|
||
</label>
|
||
</div>
|
||
|
||
<div class="mb-3">
|
||
<label class="form-label">Пароль
|
||
<input type="password" name="password" class="form-control" autocomplete="current-password">
|
||
</label>
|
||
</div>
|
||
|
||
<button type="submit" class="btn btn-primary">Войти</button>
|
||
</form>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
</html>
|