summaryrefslogtreecommitdiff
path: root/plugins/htpasswd/BridgeHtpasswd.php
diff options
context:
space:
mode:
authorChristoph Burschka2016-04-04 18:35:21 +0000
committerChristoph Burschka2016-04-04 18:35:21 +0000
commit8cd148bdb2be52b16cc4dc57a501f194c1ffb58b (patch)
treee3a500052cc560834e02c5f5befe46ebf4adb036 /plugins/htpasswd/BridgeHtpasswd.php
parentTest with domain argument. (diff)
downloadejabberd-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.php8
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);
}
}