diff options
author | Christoph Burschka | 2016-04-04 18:35:21 +0000 |
---|---|---|
committer | Christoph Burschka | 2016-04-04 18:35:21 +0000 |
commit | 8cd148bdb2be52b16cc4dc57a501f194c1ffb58b (patch) | |
tree | e3a500052cc560834e02c5f5befe46ebf4adb036 /plugins/htpasswd/BridgeHtpasswd.php | |
parent | Test with domain argument. (diff) | |
download | ejabberd-auth-php-8cd148bdb2be52b16cc4dc57a501f194c1ffb58b.tar.gz |
Add multi-domain support to htpasswd plugin.
Each domain can now use its own htpasswd file.
Diffstat (limited to 'plugins/htpasswd/BridgeHtpasswd.php')
-rw-r--r-- | plugins/htpasswd/BridgeHtpasswd.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/htpasswd/BridgeHtpasswd.php b/plugins/htpasswd/BridgeHtpasswd.php index 51b6a94..62ac1f4 100644 --- a/plugins/htpasswd/BridgeHtpasswd.php +++ b/plugins/htpasswd/BridgeHtpasswd.php @@ -9,11 +9,15 @@ class BridgeHtpasswd extends EjabberdAuthBridge { $this->config = $config; } + function getData($server) { + return array_key_exists($server, $this->data) ? $this->data[$server] : $this->data[NULL]; + } + function isuser($username, $server) { - return array_key_exists($username, $this->data); + return array_key_exists($username, $this->getData($server)); } function auth($username, $server, $password) { - return $this->isuser($username, $server) && htpasswd_check($password, $this->data[$username], $this->config); + return $this->isuser($username, $server) && htpasswd_check($password, $this->getData($server)[$username], $this->config); } } |