Восстановление пароля

This commit is contained in:
Maksym 2023-01-13 18:56:41 +01:00
parent 9ec0f42e17
commit 45fc2f51b4

View File

@ -21,6 +21,7 @@ if (isset($_POST['relogin'])) {
$u = User::start(); $u = User::start();
$usr = Db::getRow('select * from users where login =?', [$_POST['relogin']]); $usr = Db::getRow('select * from users where login =?', [$_POST['relogin']]);
if (!isset($usr['id'])) { if (!isset($usr['id'])) {
$error = 'Логин "' . htmlspecialchars($_POST['relogin'], null) . '" не найден в базе.'; $error = 'Логин "' . htmlspecialchars($_POST['relogin'], null) . '" не найден в базе.';
} else { } else {
@ -58,9 +59,11 @@ if (isset($_POST['relogin'])) {
$txt .= 'Отвечать на данное письмо не нужно.<br><br>'; $txt .= 'Отвечать на данное письмо не нужно.<br><br>';
$txt .= 'С уважением,<br>'; $txt .= 'С уважением,<br>';
$txt .= 'Администрация Бойцовского Клуба'; $txt .= 'Администрация Бойцовского Клуба';
$mail = Core\Mail::send($usr['mail'], $txt, $title);
if ($mail === 1) { $mail = mail($usr['mail'], $title, $txt);
//$mail = Core\Mail::send($usr['mail'], $txt, $title);
if ($mail) {
Db::sql( Db::sql(
'update users set securetime = unix_timestamp(), allLock = unix_timestamp(), pass = ? where id = ?', 'update users set securetime = unix_timestamp(), allLock = unix_timestamp(), pass = ? where id = ?',
[password_hash($newPassword, PASSWORD_DEFAULT), $usr['id']] [password_hash($newPassword, PASSWORD_DEFAULT), $usr['id']]