+ добавлена проверка на зпрещенные символы < > \" ' ` в пароле при инсталляции cms, иначе ситуация - пользователь отправил пароль , все ок, а зайти в админку не сможет.

This commit is contained in:
2025-10-09 13:55:37 +05:00
parent 5910c510df
commit e622f7e6fa
2 changed files with 10 additions and 5 deletions

View File

@@ -649,7 +649,10 @@ switch ($_REQUEST['step'])
$_POST['email'] = chop($_POST['email']);
$_POST['username'] = chop($_POST['username']);
$regex_username = '/[^\w-]/';
// Новое регулярное выражение, которое ищет запрещенные символы:
// <, >, ", ', `
$regex_forbidden = '/[<>\"\'`]/';
$regex_password = '/[^\x20-\xFF]/';
$regex_password = '/[^\x20-\xFF]/';
$regex_email = '/^[\w.-]+@[a-z0-9.-]+\.(?:[a-z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)$/i';
@@ -691,10 +694,11 @@ switch ($_REQUEST['step'])
}
$errors = array();
if ($_POST['email'] == '') array_push($errors, $AVE_Template->get_config_vars('noemail'));
if (! preg_match($regex_email, $_POST['email'])) array_push($errors, $AVE_Template->get_config_vars('email_no_specialchars'));
if (empty($_POST['pass']) || preg_match($regex_password, $_POST['pass'])) array_push($errors, $AVE_Template->get_config_vars('check_pass'));
if (strlen($_POST['pass']) < 5) array_push($errors, $AVE_Template->get_config_vars('pass_too_small'));
if ($_POST['email'] == '') array_push($errors, $AVE_Template->get_config_vars('noemail'));
if (! preg_match($regex_email, $_POST['email'])) array_push($errors, $AVE_Template->get_config_vars('email_no_specialchars'));
if (preg_match($regex_forbidden, $_POST['pass'])) array_push($errors, $AVE_Template->get_config_vars('forbidden_symbols_in_pass'));
if (empty($_POST['pass']) || preg_match($regex_password, $_POST['pass'])) array_push($errors, $AVE_Template->get_config_vars('check_pass'));
if (strlen($_POST['pass']) < 5) array_push($errors, $AVE_Template->get_config_vars('pass_too_small'));
if (empty($_POST['username']) || preg_match($regex_username, $_POST['username'])) array_push($errors, $AVE_Template->get_config_vars('check_username'));
$AVE_Template->assign('errors', $errors);

View File

@@ -60,6 +60,7 @@ login_field = "Поля отмеченные <span class=\"star\">*<
username = "Имя пользователя"
email = "E-mail"
password = "Пароль"
forbidden_symbols_in_pass = "Пароль не должен содержать следующие символы: < > \" ' ` "
noemail = "Пожалуйста, укажите E-mail адрес."