diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2017-12-01 01:38:06 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2017-12-01 01:38:06 +0300 |
commit | 9020dac1940fa9c52b9f29748131aa859ab16c29 (patch) | |
tree | 731e56ca9c9151cb319affa80480a26919624209 /config/global.php | |
parent | af3a79c055bfe2c5778b5827ba3d165674315f4b (diff) |
Add possibility to restrict piwik access by ip (#12242)
* add possibility to restrict piwik login by ip
* better whitelist implementation
* move classes to corehome
* better error message
* better config
* make sure ips can be overwritten via DI
* fix ui tests
Diffstat (limited to 'config/global.php')
-rw-r--r-- | config/global.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/config/global.php b/config/global.php index 9687047a82..00c2d116aa 100644 --- a/config/global.php +++ b/config/global.php @@ -117,6 +117,18 @@ return array( 'Piwik\EventDispatcher' => DI\object()->constructorParameter('observers', DI\get('observers.global')), + 'login.whitelist.ips' => function (ContainerInterface $c) { + /** @var Piwik\Config\ $config */ + $config = $c->get('Piwik\Config'); + $general = $config->General; + + $ips = array(); + if (!empty($general['login_whitelist_ip']) && is_array($general['login_whitelist_ip'])) { + $ips = $general['login_whitelist_ip']; + } + return $ips; + }, + 'Zend_Validate_EmailAddress' => function () { return new \Zend_Validate_EmailAddress(array( 'hostname' => new \Zend_Validate_Hostname(array( |