From 657864a29c96b15069a304693cc557b1d9b27b1c Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 16 Nov 2012 13:42:57 -0500
Subject: [PATCH] Merge pull request #42 from NETLINK/patch-1

---
 plugins/password/config.inc.php.dist |    9 +++++++++
 plugins/password/password.php        |    8 +++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/plugins/password/config.inc.php.dist b/plugins/password/config.inc.php.dist
index 8d7b433..db5c47b 100644
--- a/plugins/password/config.inc.php.dist
+++ b/plugins/password/config.inc.php.dist
@@ -1,5 +1,14 @@
 <?php
 
+// Supported hosts
+// -----------------------
+// Array of hosts that support password changing.
+// Default is NULL. Supported hosts will feature
+// a Password option in Settings; others will not.
+// Example:
+//$rcmail_config['password_supported_hosts'] = array( 'mail.example.com', 'mail2.example.org' );
+$rcmail_config['password_supported_hosts'] = NULL;
+
 // Password Plugin options
 // -----------------------
 // A driver to use for password change. Default: "sql".
diff --git a/plugins/password/password.php b/plugins/password/password.php
index e795d11..cd0f5f1 100644
--- a/plugins/password/password.php
+++ b/plugins/password/password.php
@@ -3,7 +3,7 @@
 /*
  +-------------------------------------------------------------------------+
  | Password Plugin for Roundcube                                           |
- | @version @package_version@                                                             |
+ | @version @package_version@                                              |
  |                                                                         |
  | Copyright (C) 2009-2010, Roundcube Dev.                                 |
  |                                                                         |
@@ -55,6 +55,12 @@
         $rcmail = rcmail::get_instance();
 
         $this->load_config();
+        
+        $host = isset( $_SESSION['imap_host'] ) ? $_SESSION['imap_host'] : NULL;
+        $hosts = $rcmail->config->get( 'password_supported_hosts' );
+        if ( !empty( $hosts ) and !in_array( $host, $hosts ) ) {
+            return;
+        }
 
         // Exceptions list
         if ($exceptions = $rcmail->config->get('password_login_exceptions')) {

--
Gitblit v1.9.1