Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions app/Controllers/authController.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,18 @@ public function formLoginAction() {
$limits = $conf->limits;
$this->view->cookie_days = round($limits['cookie_duration'] / 86400, 1);

if (Minz_Request::isPost()) {
$isPOST = Minz_Request::isPost() && !Minz_Session::param('POST_to_GET');
Minz_Session::_param('POST_to_GET');

if ($isPOST) {
$nonce = Minz_Session::param('nonce');
$username = Minz_Request::param('username', '');
$challenge = Minz_Request::param('challenge', '');

$conf = get_user_configuration($username);
if ($conf == null) {
Minz_Request::bad(
_t('feedback.auth.login.invalid'),
array('c' => 'auth', 'a' => 'login')
);
//We do not test here whether the user exists, so most likely an internal error.
Minz_Error::error(403, array(_t('feedback.auth.login.invalid')), false);
return;
}

Expand Down Expand Up @@ -155,10 +156,15 @@ public function formLoginAction() {
' user=' . $username .
', nonce=' . $nonce .
', c=' . $challenge);
Minz_Request::bad(
_t('feedback.auth.login.invalid'),
array('c' => 'auth', 'a' => 'login')
);

header('HTTP/1.1 403 Forbidden');
Comment thread
marienfressinaud marked this conversation as resolved.
Resolved
Minz_Session::_param('POST_to_GET', true); //Prevent infinite internal redirect
Comment thread
marienfressinaud marked this conversation as resolved.
Resolved
Minz_View::_param('notification', [
'type' => 'bad',
'content' => _t('feedback.auth.login.invalid'),
]);
Minz_Request::forward(['c' => 'auth', 'a' => 'login'], false);
return;
}
} elseif (FreshRSS_Context::$system_conf->unsafe_autologin_enabled) {
$username = Minz_Request::param('u', '');
Expand Down
1 change: 1 addition & 0 deletions app/Models/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ public static function isCsrfOk($token = null) {
class FreshRSS_FormAuth {
public static function checkCredentials($username, $hash, $nonce, $challenge) {
if (!FreshRSS_user_Controller::checkUsername($username) ||
!ctype_graph($hash) ||
Comment thread
Alkarex marked this conversation as resolved.
Resolved
!ctype_graph($challenge) ||
!ctype_alnum($nonce)) {
Minz_Log::debug('Invalid credential parameters:' .
Expand Down