many fixes in design and add shirt story type for creation book

This commit is contained in:
2026-05-01 20:51:42 +03:00
parent 9294399517
commit ce6fffaa57
24 changed files with 1167 additions and 735 deletions
+11 -2
View File
@@ -19,8 +19,12 @@ class AuthController extends BaseController {
} else {
$username = trim($_POST['username'] ?? '');
$password = $_POST['password'] ?? '';
$ip = $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0';
if (empty($username) || empty($password)) {
// Проверка Rate Limit
if (!checkRateLimit($this->pdo, $ip)) {
$error = 'Слишком много попыток входа. Попробуйте позже.';
} elseif (empty($username) || empty($password)) {
$error = 'Пожалуйста, введите имя пользователя и пароль';
} else {
$userModel = new User($this->pdo);
@@ -29,8 +33,12 @@ class AuthController extends BaseController {
if ($user && $userModel->verifyPassword($password, $user['password_hash'])) {
if (!$user['is_active']) {
$error = 'Ваш аккаунт деактивирован или ожидает активации администратором.';
logLoginAttempt($this->pdo, $ip, $username);
} else {
// Успешный вход
// Успешный вход - очищаем попытки
clearLoginAttempts($this->pdo, $ip);
// Обновляем сессию
session_regenerate_id(true);
$_SESSION['user_id'] = $user['id'];
$_SESSION['username'] = $user['username'];
@@ -45,6 +53,7 @@ class AuthController extends BaseController {
}
} else {
$error = 'Неверное имя пользователя или пароль';
logLoginAttempt($this->pdo, $ip, $username);
}
}
}