1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 11:05:55 +00:00

userhelper: use orm for a few more user-related things

This commit is contained in:
Andrew Dolgov
2021-03-01 19:32:27 +03:00
parent 127a868e40
commit 8b1a2406e6
6 changed files with 65 additions and 87 deletions

View File

@@ -36,27 +36,21 @@
return false;
}
$sth = $pdo->prepare("SELECT pwd_hash FROM ttrss_users WHERE id = ?");
$sth->execute([$_SESSION['uid']]);
$user = \ORM::for_table('ttrss_users')->find_one($_SESSION["uid"]);
// user not found
if ($row = $sth->fetch()) {
$pwd_hash = $row["pwd_hash"];
if ($user) {
if ($user->pwd_hash != $_SESSION["pwd_hash"]) {
if ($pwd_hash != $_SESSION["pwd_hash"]) {
$_SESSION["login_error_msg"] =
__("Session failed to validate (password changed)");
$_SESSION["login_error_msg"] =
__("Session failed to validate (password changed)");
return false;
}
return false;
}
} else {
$_SESSION["login_error_msg"] =
__("Session failed to validate (user not found)");
$_SESSION["login_error_msg"] =
__("Session failed to validate (user not found)");
return false;
return false;
}
}