diff --git a/plugins/Login/Controller.php b/plugins/Login/Controller.php index ceb7204a726aa300998534e2f705d4a8dc333905..65e12e32b4d3c8fae008ffc7c8a9954bb53bfd27 100644 --- a/plugins/Login/Controller.php +++ b/plugins/Login/Controller.php @@ -199,13 +199,12 @@ class Piwik_Login_Controller extends Piwik_Controller $mail = new Piwik_Mail(); $mail->addTo($email, $login); $mail->setSubject(Piwik_Translate('Login_MailTopicPasswordRecovery')); - $mail->setBodyText( - str_replace( + $bodyText = str_replace( '\n', "\n", sprintf(Piwik_Translate('Login_MailPasswordRecoveryBody'), $login, $ip, $url, $resetToken) - ) . "\n" - ); + ) . "\n"; + $mail->setBodyText($bodyText); $piwikHost = $_SERVER['HTTP_HOST']; if(strlen($piwikHost) == 0) @@ -279,10 +278,15 @@ class Piwik_Login_Controller extends Piwik_Controller return Piwik_Translate('Login_InvalidOrExpiredToken'); } + $view = Piwik_View::factory('passwordchanged'); try { if( $user['email'] == Zend_Registry::get('config')->superuser->email ) { + if(!Zend_Registry::get('config')->isFileWritable()) + { + throw new Exception(Piwik_Translate('General_ConfigFileIsNotWritable', array("(config/config.ini.php)","<br/>"))); + } $user['password'] = md5($password); Zend_Registry::get('config')->superuser = $user; } @@ -296,7 +300,6 @@ class Piwik_Login_Controller extends Piwik_Controller $view->ErrorString = $e->getMessage(); } - $view = Piwik_View::factory('passwordchanged'); $view->linkTitle = Piwik::getRandomTitle(); echo $view->render(); diff --git a/plugins/Login/templates/passwordchanged.tpl b/plugins/Login/templates/passwordchanged.tpl index 5337abc2c22ceeb35c712e225cc03aa2a1bfc12c..bc55d94f15d962b843c91b0804936622bbecc307 100644 --- a/plugins/Login/templates/passwordchanged.tpl +++ b/plugins/Login/templates/passwordchanged.tpl @@ -4,7 +4,6 @@ {if isset($ErrorString)} <div id="login_error"><strong>{'General_Error'|translate}</strong>: {$ErrorString}<br /> - {'Login_ContactAdmin'|translate} </div> {else} <p class="message"> diff --git a/tests/integration/Main.test.php b/tests/integration/Main.test.php index 4075438608cda9fe9d42e029f9bdea28bdad89a1..6a0c6b0f865feecb647cf28468e2b0a64e67339c 100644 --- a/tests/integration/Main.test.php +++ b/tests/integration/Main.test.php @@ -16,7 +16,7 @@ require_once PIWIK_INCLUDE_PATH . '/tests/integration/Integration.php'; * * The test calls the Piwik tracker with known sets of data, expected errors, * and can test the output of the tracker beacon, as well as calling - * all API functions, and Widgets, and compare their XML/HTML output with the 'expected output'. + * all API functions and compare their HTML output with the 'expected output'. * * If an algorithm changes in the Tracker or in the Archiving, tests can easily be run to check that * the output changes as expected (eg. More accurate browser detection, adding a new metric in the @@ -74,7 +74,7 @@ class Test_Piwik_Integration_Main extends Test_Integration $t->setIp($excludedIpBis); $this->checkResponse($t->doTrackPageView('visit from IP globally excluded')); - + // this will output empty XML result sets as no visit was tracked $this->callGetApiCompareOutput(__FUNCTION__, 'xml', $idSite, $dateTime); }