aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/Request.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Minz/Request.php')
-rw-r--r--lib/Minz/Request.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php
index 3355058f1..0e8dc28d0 100644
--- a/lib/Minz/Request.php
+++ b/lib/Minz/Request.php
@@ -560,6 +560,22 @@ class Minz_Request {
return 'POST' === ($_SERVER['REQUEST_METHOD'] ?? '');
}
+ public static function tokenIsOk(): bool {
+ $token_param = self::paramString('token');
+ if ($token_param == '') {
+ return false;
+ }
+ $username = self::paramString('user');
+ if ($username == '') {
+ return false;
+ }
+ $conf = FreshRSS_UserConfiguration::getForUser($username);
+ if ($conf === null || !hash_equals($conf->token, $token_param)) {
+ return false;
+ }
+ return true;
+ }
+
/**
* @return list<string>
*/