diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2012-05-29 13:08:49 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2012-05-29 13:08:49 +0400 |
commit | 3b7e244e21d88fd3aac2f98b96a235cb76c5c0ac (patch) | |
tree | 0db809417ef476d36ffb532cc405f73bb62438b3 | |
parent | 9f211da799a4841aaefc3e89d2ed2fea8ffa27aa (diff) |
Refs #3080
* Enabling adding localhost / 127.0.0.1 to trusted hosts list otherwise logging in was failing in my test Install
* Disable the feature until we have the UI to change the URL or display some kind of warning "The host you are using is different from the hostname known for this Piwik server. Do you wish to add the hostname %S to the list of trusted hostname?" Then the super user could accept. Otherwise this will cause problems with users migrating to different URLs which will then break logging (as the "Local URL" test will fail after piwik url changes)
git-svn-id: http://dev.piwik.org/svn/trunk@6370 59fd770c-687e-43c8-a1e3-f5a4ff64c105
-rw-r--r-- | plugins/Installation/Controller.php | 7 | ||||
-rw-r--r-- | plugins/Login/Controller.php | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php index a68278f334..d621cd5ca4 100644 --- a/plugins/Installation/Controller.php +++ b/plugins/Installation/Controller.php @@ -525,7 +525,7 @@ class Piwik_Installation_Controller extends Piwik_Controller if(!file_exists(Piwik_Config::getLocalConfigPath())) { - $this->addTrustedHosts(); +// $this->addTrustedHosts(); $this->writeConfigFileFromSession(); } @@ -693,10 +693,8 @@ class Piwik_Installation_Controller extends Piwik_Controller */ protected function extractHost($url) { - $skipLocalHosts = array('localhost', '127.0.0.1', '[::1]'); - $urlParts = parse_url($url); - if (isset($urlParts['host']) && strlen($host = $urlParts['host']) && !in_array($host, $skipLocalHosts)) + if (isset($urlParts['host']) && strlen($host = $urlParts['host'])) { return $host; } @@ -723,6 +721,7 @@ class Piwik_Installation_Controller extends Piwik_Controller $trustedHosts[] = $host; } + $trustedHosts = array_unique($trustedHosts); if (count($trustedHosts)) { $this->session->general_infos['trusted_hosts'] = $trustedHosts; diff --git a/plugins/Login/Controller.php b/plugins/Login/Controller.php index 6daf725bb6..d33bc4e451 100644 --- a/plugins/Login/Controller.php +++ b/plugins/Login/Controller.php @@ -194,7 +194,9 @@ class Piwik_Login_Controller extends Piwik_Controller protected function getMessageExceptionNoAccess() { - return Piwik_Translate('Login_InvalidNonceOrHeadersOrReferer', array('<a href="?module=Proxy&action=redirect&url='.urlencode('http://piwik.org/faq/how-to-install/#faq_98').'" target="_blank">', '</a>')); + $message = Piwik_Translate('Login_InvalidNonceOrHeadersOrReferer', array('<a href="?module=Proxy&action=redirect&url='.urlencode('http://piwik.org/faq/how-to-install/#faq_98').'" target="_blank">', '</a>')); + // Should mention trusted_hosts or link to FAQ + return $message; } /** |