summaryrefslogtreecommitdiff
path: root/classes/pref/users.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-11 10:22:27 +0300
committerAndrew Dolgov <[email protected]>2021-02-11 10:22:27 +0300
commit09e9f34bb495b435e826bce8cf716258039d4642 (patch)
tree60cdaf053a0af182cc66002790548caf09339c25 /classes/pref/users.php
parent7af8744c856545f62a2f24fd1a700f40b90b8e37 (diff)
add UserHelper::find_user_by_login() and rewrite some user checks to invoke it instead of going through PDO
Diffstat (limited to 'classes/pref/users.php')
-rw-r--r--classes/pref/users.php12
1 files changed, 2 insertions, 10 deletions
diff --git a/classes/pref/users.php b/classes/pref/users.php
index 45c4b82b8..67daa884f 100644
--- a/classes/pref/users.php
+++ b/classes/pref/users.php
@@ -237,22 +237,14 @@ class Pref_Users extends Handler_Protected {
if (!$login) return; // no blank usernames
- $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE
- LOWER(login) = LOWER(?)");
- $sth->execute([$login]);
-
- if (!$sth->fetch()) {
+ if (!UserHelper::find_user_by_login($login)) {
$sth = $this->pdo->prepare("INSERT INTO ttrss_users
(login,pwd_hash,access_level,last_login,created, salt)
VALUES (LOWER(?), ?, 0, null, NOW(), ?)");
$sth->execute([$login, $pwd_hash, $salt]);
- $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE
- LOWER(login) = LOWER(?) AND pwd_hash = ?");
- $sth->execute([$login, $pwd_hash]);
-
- if ($row = $sth->fetch()) {
+ if ($new_uid = UserHelper::find_user_by_login($login)) {
$new_uid = $row['id'];