From 8cd148bdb2be52b16cc4dc57a501f194c1ffb58b Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Mon, 4 Apr 2016 18:35:21 +0000 Subject: Add multi-domain support to htpasswd plugin. Each domain can now use its own htpasswd file. --- plugins/htpasswd/BridgeHtpasswd.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'plugins/htpasswd/BridgeHtpasswd.php') 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); } } -- cgit v1.1