mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-24 16:25:00 -04:00
Improve code redirection for indexController
- add comments - forward request is done in the controller (no Minz_Request::forward() in the view, please) - "soft" forward to the login form (no need of 302) - show a 403 page (no authenticated) for rss output when token is wrong
This commit is contained in:
@@ -11,7 +11,16 @@ class FreshRSS_index_Controller extends Minz_ActionController {
|
||||
if (!$this->view->loginOk && !Minz_Configuration::allowAnonymous()) {
|
||||
$token_param = Minz_Request::param ('token', '');
|
||||
$token_is_ok = ($token != '' && $token === $token_param);
|
||||
if (!($output === 'rss' && $token_is_ok)) {
|
||||
if ($output === 'rss' && !$token_is_ok) {
|
||||
Minz_Error::error (
|
||||
403,
|
||||
array ('error' => array (Minz_Translate::t ('access_denied')))
|
||||
);
|
||||
return;
|
||||
} elseif ($output !== 'rss') {
|
||||
// "hard" redirection is not required, just ask dispatcher to
|
||||
// forward to the login form without 302 redirection
|
||||
Minz_Request::forward(array('c' => 'index', 'a' => 'formLogin'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user