diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-02-07 12:19:39 +0400 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-02-07 12:20:36 +0400 |
commit | dfb926b20ef155b415835515f241e4eed8a01338 (patch) | |
tree | 9eeae4246f8e4a3a04a1470b0287bccfa14c105c /plugins | |
parent | e26bf88c453eeaf1d8bfcd89c900af62d656339c (diff) |
Lowercase username if 'login_lc' is set (#1488943)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/acl/acl.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php index eb8433a27..18bac8e1b 100644 --- a/plugins/acl/acl.php +++ b/plugins/acl/acl.php @@ -452,6 +452,9 @@ class acl extends rcube_plugin continue; } + $user = $this->mod_login($user); + $username = $this->mod_login($username); + if ($user != $_SESSION['username'] && $username != $_SESSION['username']) { if ($this->rc->storage->set_acl($mbox, $user, $acl)) { $ret = array('id' => rcube_utils::html_identifier($user), @@ -703,4 +706,23 @@ class acl extends rcube_plugin return $this->ldap->ready; } + + /** + * Modify user login according to 'login_lc' setting + */ + protected function mod_login($user) + { + $login_lc = $this->rc->config->get('login_lc'); + + if ($login_lc === true || $login_lc == 2) { + $user = mb_strtolower($user); + } + // lowercase domain name + else if ($login_lc && strpos($user, '@')) { + list($local, $domain) = explode('@', $user); + $user = $local . '@' . mb_strtolower($domain); + } + + return $user; + } } |