aboutsummaryrefslogtreecommitdiff
path: root/app/Models/FormAuth.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-04-05 23:26:38 +0200
committerGravatar GitHub <noreply@github.com> 2023-04-05 23:26:38 +0200
commit2118448133e327294ad2b69ed8736bc29879103d (patch)
tree00c003056dedbd8e3554801d6493a25641a260a5 /app/Models/FormAuth.php
parent4f078958b5603900592e14f9f3189bbebfc81bab (diff)
PHPStan level 6 for more files (#5264)
7 more files passing (see phpstan-next.txt)
Diffstat (limited to 'app/Models/FormAuth.php')
-rw-r--r--app/Models/FormAuth.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/Models/FormAuth.php b/app/Models/FormAuth.php
index 653eba04b..476daba53 100644
--- a/app/Models/FormAuth.php
+++ b/app/Models/FormAuth.php
@@ -13,7 +13,8 @@ class FreshRSS_FormAuth {
return password_verify($nonce . $hash, $challenge);
}
- public static function getCredentialsFromCookie() {
+ /** @return array<string> */
+ public static function getCredentialsFromCookie(): array {
$token = Minz_Session::getLongTermCookie('FreshRSS_login');
if (!ctype_alnum($token)) {
return array();
@@ -36,6 +37,7 @@ class FreshRSS_FormAuth {
return [];
}
+ /** @return string|false */
private static function renewCookie(string $token) {
$token_file = DATA_PATH . '/tokens/' . $token . '.txt';
if (touch($token_file)) {
@@ -48,6 +50,7 @@ class FreshRSS_FormAuth {
return false;
}
+ /** @return string|false */
public static function makeCookie(string $username, string $password_hash) {
do {
$token = sha1(FreshRSS_Context::$system_conf->salt . $username . uniqid('' . mt_rand(), true));
@@ -61,7 +64,7 @@ class FreshRSS_FormAuth {
return self::renewCookie($token);
}
- public static function deleteCookie() {
+ public static function deleteCookie(): void {
$token = Minz_Session::getLongTermCookie('FreshRSS_login');
if (ctype_alnum($token)) {
Minz_Session::deleteLongTermCookie('FreshRSS_login');
@@ -73,7 +76,7 @@ class FreshRSS_FormAuth {
}
}
- public static function purgeTokens() {
+ public static function purgeTokens(): void {
$limits = FreshRSS_Context::$system_conf->limits;
$cookie_duration = empty($limits['cookie_duration']) ? FreshRSS_Auth::DEFAULT_COOKIE_DURATION : $limits['cookie_duration'];
$oldest = time() - $cookie_duration;