Skip to content
Extraits de code Groupes Projets
Valider f86691a3 rédigé par mattpiwik's avatar mattpiwik
Parcourir les fichiers

Fixes #1472. Super user password reset will fail with message if config file not writable.

git-svn-id: http://dev.piwik.org/svn/trunk@2473 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent f8529971
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -199,13 +199,12 @@ class Piwik_Login_Controller extends Piwik_Controller ...@@ -199,13 +199,12 @@ class Piwik_Login_Controller extends Piwik_Controller
$mail = new Piwik_Mail(); $mail = new Piwik_Mail();
$mail->addTo($email, $login); $mail->addTo($email, $login);
$mail->setSubject(Piwik_Translate('Login_MailTopicPasswordRecovery')); $mail->setSubject(Piwik_Translate('Login_MailTopicPasswordRecovery'));
$mail->setBodyText( $bodyText = str_replace(
str_replace(
'\n', '\n',
"\n", "\n",
sprintf(Piwik_Translate('Login_MailPasswordRecoveryBody'), $login, $ip, $url, $resetToken) sprintf(Piwik_Translate('Login_MailPasswordRecoveryBody'), $login, $ip, $url, $resetToken)
) . "\n" ) . "\n";
); $mail->setBodyText($bodyText);
$piwikHost = $_SERVER['HTTP_HOST']; $piwikHost = $_SERVER['HTTP_HOST'];
if(strlen($piwikHost) == 0) if(strlen($piwikHost) == 0)
...@@ -279,10 +278,15 @@ class Piwik_Login_Controller extends Piwik_Controller ...@@ -279,10 +278,15 @@ class Piwik_Login_Controller extends Piwik_Controller
return Piwik_Translate('Login_InvalidOrExpiredToken'); return Piwik_Translate('Login_InvalidOrExpiredToken');
} }
$view = Piwik_View::factory('passwordchanged');
try try
{ {
if( $user['email'] == Zend_Registry::get('config')->superuser->email ) 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); $user['password'] = md5($password);
Zend_Registry::get('config')->superuser = $user; Zend_Registry::get('config')->superuser = $user;
} }
...@@ -296,7 +300,6 @@ class Piwik_Login_Controller extends Piwik_Controller ...@@ -296,7 +300,6 @@ class Piwik_Login_Controller extends Piwik_Controller
$view->ErrorString = $e->getMessage(); $view->ErrorString = $e->getMessage();
} }
$view = Piwik_View::factory('passwordchanged');
$view->linkTitle = Piwik::getRandomTitle(); $view->linkTitle = Piwik::getRandomTitle();
echo $view->render(); echo $view->render();
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
{if isset($ErrorString)} {if isset($ErrorString)}
<div id="login_error"><strong>{'General_Error'|translate}</strong>: {$ErrorString}<br /> <div id="login_error"><strong>{'General_Error'|translate}</strong>: {$ErrorString}<br />
{'Login_ContactAdmin'|translate}
</div> </div>
{else} {else}
<p class="message"> <p class="message">
......
...@@ -16,7 +16,7 @@ require_once PIWIK_INCLUDE_PATH . '/tests/integration/Integration.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, * 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 * 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 * 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 * 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 ...@@ -74,7 +74,7 @@ class Test_Piwik_Integration_Main extends Test_Integration
$t->setIp($excludedIpBis); $t->setIp($excludedIpBis);
$this->checkResponse($t->doTrackPageView('visit from IP globally excluded')); $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); $this->callGetApiCompareOutput(__FUNCTION__, 'xml', $idSite, $dateTime);
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter