A free, self-hostable news aggregator…
Debug Persona temporaire
Alexandre Alapetite1fb25addd096
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.phpindex 690ca57be..9817b7a81 100755--- a/app/Controllers/indexController.php+++ b/app/Controllers/indexController.php@@ -237,6 +237,7 @@ class FreshRSS_index_Controller extends Minz_ActionController {$assert = Minz_Request::param ('assertion');$params = 'assertion=' . $assert . '&audience=' .urlencode (Minz_Url::display (null, 'php', true));+ file_put_contents(DATA_PATH . '/log/persona.log', date('c') . ' login params=' . print_r($params, true) . "\n", FILE_APPEND); //DEBUG$ch = curl_init ();$options = array (CURLOPT_URL => $url,@@ -252,8 +253,10 @@ class FreshRSS_index_Controller extends Minz_ActionController {$loginOk = false;$reason = '';+ file_put_contents(DATA_PATH . '/log/persona.log', date('c') . ' login response=' . print_r($res, true) . "\n", FILE_APPEND); //DEBUGif ($res['status'] === 'okay') {$email = filter_var($res['email'], FILTER_VALIDATE_EMAIL);+ file_put_contents(DATA_PATH . '/log/persona.log', date('c') . ' filtered_email=' . $email . "\n", FILE_APPEND); //DEBUGif ($email != '') {$personaFile = DATA_PATH . '/persona/' . $email . '.txt';if (($currentUser = @file_get_contents($personaFile)) !== false) {@@ -277,12 +280,14 @@ class FreshRSS_index_Controller extends Minz_ActionController {Minz_Session::_param('currentUser', $currentUser);Minz_Session::_param ('mail', $email);$this->view->loginOk = true;+ file_put_contents(DATA_PATH . '/log/persona.log', date('c') . ' Login OK email=' . $email . ', currentUser=' . $currentUser . "\n", FILE_APPEND); //DEBUGinvalidateHttpCache();} else {$res = array ();$res['status'] = 'failure';$res['reason'] = $reason == '' ? Minz_Translate::t ('invalid_login') : $reason;Minz_Log::record ('Persona: ' . $res['reason'], Minz_Log::WARNING);+ file_put_contents(DATA_PATH . '/log/persona.log', date('c') . ' Failure=' . print_r($res, true) . "\n", FILE_APPEND); //DEBUG}header('Content-Type: application/json; charset=UTF-8');diff --git a/app/FreshRSS.php b/app/FreshRSS.phpindex f9857a4cb..86d35a6e7 100644--- a/app/FreshRSS.php+++ b/app/FreshRSS.php@@ -11,6 +11,7 @@ class FreshRSS extends Minz_FrontController {}private function accessControl($currentUser) {+ file_put_contents(DATA_PATH . '/log/persona.log', date('c') . ' authType=' . Minz_Configuration::authType() . "\n", FILE_APPEND); //DEBUGif ($currentUser == '') {switch (Minz_Configuration::authType()) {case 'http_auth':@@ -18,12 +19,15 @@ class FreshRSS extends Minz_FrontController {$loginOk = $currentUser != '';break;case 'persona':+ file_put_contents(DATA_PATH . '/log/persona.log', date('c') . ' Persona access control' . "\n", FILE_APPEND); //DEBUG$loginOk = false;$email = filter_var(Minz_Session::param('mail'), FILTER_VALIDATE_EMAIL);+ file_put_contents(DATA_PATH . '/log/persona.log', date('c') . ' Persona email=' . Minz_Session::param('mail') . ', filtered_email=' . $email . "\n", FILE_APPEND);if ($email != '') { //TODO: Remove redundancy with indexController$personaFile = DATA_PATH . '/persona/' . $email . '.txt';if (($currentUser = @file_get_contents($personaFile)) !== false) {$currentUser = trim($currentUser);+ file_put_contents(DATA_PATH . '/log/persona.log', date('c') . ' Persona user from file=' . $currentUser . "\n", FILE_APPEND); //DEBUG$loginOk = true;}}@@ -77,6 +81,7 @@ class FreshRSS extends Minz_FrontController {$loginOk = strcasecmp($currentUser, httpAuthUser()) === 0;break;case 'persona':+ file_put_contents(DATA_PATH . '/log/persona.log', date('c') . ' Persona compare session_email=' . Minz_Session::param('mail') . ' with config_email=' . $this->conf->mail_login . "\n", FILE_APPEND); //DEBUG$loginOk = strcasecmp(Minz_Session::param('mail'), $this->conf->mail_login) === 0;break;case 'none':