aboutsummaryrefslogtreecommitdiff
path: root/app/Models/FormAuth.php
diff options
context:
space:
mode:
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;