Skip to content

Commit

Permalink
Fever API: Log messages for wrong credendials (FreshRSS#1910)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkarex authored and mdemoss committed Mar 25, 2021
1 parent e378de4 commit 2d8abd8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions p/api/fever.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// check if API is enabled globally
FreshRSS_Context::$system_conf = Minz_Configuration::get('system');
if (!FreshRSS_Context::$system_conf->api_enabled) {
Minz_Log::warning('serviceUnavailable() ' . debugInfo(), API_LOG);
Minz_Log::warning('Fever API: serviceUnavailable() ' . debugInfo(), API_LOG);
header('HTTP/1.1 503 Service Unavailable');
header('Content-Type: text/plain; charset=UTF-8');
die('Service Unavailable!');
Expand Down Expand Up @@ -146,13 +146,19 @@ private function authenticate()
$username = @file_get_contents(DATA_PATH . '/fever/.key-' . sha1(FreshRSS_Context::$system_conf->salt) . '-' . $feverKey . '.txt', false);
if ($username != false) {
$username = trim($username);
Minz_Session::_param('currentUser', $username);
$user_conf = get_user_configuration($username);
if ($user_conf != null && $feverKey === $user_conf->feverKey) {
FreshRSS_Context::$user_conf = $user_conf;
Minz_Session::_param('currentUser', $username);
return true;
}
Minz_Log::error('Fever API: Reset API password for user: ' . $username, API_LOG);
Minz_Log::error('Fever API: Please reset your API password!');
Minz_Session::_param('currentUser');
}
Minz_Log::warning('Fever API: wrong credentials! ' . $feverKey, API_LOG);
}
return false;
}

/**
Expand Down Expand Up @@ -616,7 +622,7 @@ protected function setGroupAsRead($id, $before)
// ================================================================================================
// refresh is not allowed yet, probably we find a way to support it later
if (isset($_REQUEST["refresh"])) {
Minz_Log::warning('Refresh items for fever API - notImplemented()', API_LOG);
Minz_Log::warning('Fever API: Refresh items - notImplemented()', API_LOG);
header('HTTP/1.1 501 Not Implemented');
header('Content-Type: text/plain; charset=UTF-8');
die('Not Implemented!');
Expand Down

0 comments on commit 2d8abd8

Please sign in to comment.