summaryrefslogtreecommitdiff
path: root/plugins/password
diff options
context:
space:
mode:
authorsimonp <simon.plasger@web.de>2014-06-07 13:03:41 +0200
committersimonp <simon.plasger@web.de>2014-06-07 13:03:41 +0200
commit6f7042e5820997464fa2198487d37e90cbf054f9 (patch)
tree15661cf05aa04435a8b308fbf2b0beb309dd3383 /plugins/password
parent9e9c03cb9078b9d9a89979e8cace8d9370cf972c (diff)
Fix for login/hosts exceptions
Diffstat (limited to 'plugins/password')
-rw-r--r--plugins/password/password.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/plugins/password/password.php b/plugins/password/password.php
index 2448b4563..74c53c9d9 100644
--- a/plugins/password/password.php
+++ b/plugins/password/password.php
@@ -44,6 +44,8 @@ class password extends rcube_plugin
public $noframe = true;
public $noajax = true;
private $newuser = false;
+ private $login_exceptions;
+ private $allowed_hosts;
function init()
{
@@ -53,6 +55,7 @@ class password extends rcube_plugin
// Host exceptions
$hosts = $rcmail->config->get('password_hosts');
+ $this->allowed_hosts = $hosts;
if (!empty($hosts) && !in_array($_SESSION['storage_host'], $hosts)) {
return;
}
@@ -61,6 +64,7 @@ class password extends rcube_plugin
if ($exceptions = $rcmail->config->get('password_login_exceptions')) {
$exceptions = array_map('trim', (array) $exceptions);
$exceptions = array_filter($exceptions);
+ $this->login_exceptions = $exceptions;
$username = $_SESSION['username'];
foreach ($exceptions as $ec) {
@@ -78,7 +82,6 @@ class password extends rcube_plugin
$this->register_action('plugin.password', array($this, 'password_init'));
$this->register_action('plugin.password-save', array($this, 'password_save'));
- $this->register_action('plugin.password-first', array($this, 'password_first'));
if (strpos($rcmail->action, 'plugin.password') === 0) {
@@ -319,6 +322,18 @@ class password extends rcube_plugin
function login_after($args)
{
+ $rcmail = rcmail::get_instance();
+ $userstruct = $rcmail->user;
+ $username = $userstruct->get_username();
+ foreach ($this->login_exceptions as $ec) {
+ if ($username === $ec) {
+ return $args;
+ }
+ }
+ $domain = $userstruct->get_username('domain');
+ if (!empty($this->allowed_hosts) && !in_array($domain, $this->allowed_hosts)) {
+ return;
+ }
if($this->newuser)
{
$args['_task'] = 'settings';