summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-11-14 21:09:53 +0300
committerAndrew Dolgov <[email protected]>2021-11-14 21:09:53 +0300
commitf537502fce498118543d47b3d1cb463104f25b1d (patch)
tree3d207a37fd5308b68687cb33e3f0069e6e43aa08 /plugins
parent67a89e861d2fb03624f12b1b8b76a796ef6186fc (diff)
deal with (most of) phpstan warnings in auth_internal and auth_remote
Diffstat (limited to 'plugins')
-rw-r--r--plugins/auth_internal/init.php22
-rw-r--r--plugins/auth_remote/init.php2
2 files changed, 20 insertions, 4 deletions
diff --git a/plugins/auth_internal/init.php b/plugins/auth_internal/init.php
index b66f7719b..1bf3d6a24 100644
--- a/plugins/auth_internal/init.php
+++ b/plugins/auth_internal/init.php
@@ -130,7 +130,7 @@ class Auth_Internal extends Auth_Base {
}
if ($login) {
- $try_user_id = $this->find_user_by_login($login);
+ $try_user_id = UserHelper::find_user_by_login($login);
if ($try_user_id) {
return $this->check_password($try_user_id, $password);
@@ -140,6 +140,14 @@ class Auth_Internal extends Auth_Base {
return false;
}
+ /**
+ * @param int $owner_uid
+ * @param string $password
+ * @param string $service
+ * @return int|false (false if failed, user id otherwise)
+ * @throws PDOException
+ * @throws Exception
+ */
function check_password(int $owner_uid, string $password, string $service = '') {
$user = ORM::for_table('ttrss_users')->find_one($owner_uid);
@@ -203,7 +211,7 @@ class Auth_Internal extends Auth_Base {
return false;
}
- function change_password($owner_uid, $old_password, $new_password) {
+ function change_password(int $owner_uid, string $old_password, string $new_password) : string {
if ($this->check_password($owner_uid, $old_password)) {
@@ -246,7 +254,15 @@ class Auth_Internal extends Auth_Base {
}
}
- private function check_app_password($login, $password, $service) {
+ /**
+ * @param string $login
+ * @param string $password
+ * @param string $service
+ * @return false|int (false if failed, user id otherwise)
+ * @throws PDOException
+ * @throws Exception
+ */
+ private function check_app_password(string $login, string $password, string $service) {
$sth = $this->pdo->prepare("SELECT p.id, p.pwd_hash, u.id AS uid
FROM ttrss_app_passwords p, ttrss_users u
WHERE p.owner_uid = u.id AND LOWER(u.login) = LOWER(?) AND service = ?");
diff --git a/plugins/auth_remote/init.php b/plugins/auth_remote/init.php
index 35ee9e31d..9c15d3368 100644
--- a/plugins/auth_remote/init.php
+++ b/plugins/auth_remote/init.php
@@ -12,7 +12,7 @@ class Auth_Remote extends Auth_Base {
$host->add_hook($host::HOOK_AUTH_USER, $this);
}
- function get_login_by_ssl_certificate() {
+ function get_login_by_ssl_certificate() : string {
$cert_serial = Pref_Prefs::_get_ssl_certificate_id();
if ($cert_serial) {