summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-02-07 09:19:39 +0100
committerAleksander Machniak <alec@alec.pl>2013-02-07 09:21:34 +0100
commit0be1804c008054d5ff98365ea936b550e9291673 (patch)
tree9cf2b6326b838745a8c5f769e3f75909e222fe0c
parentd3b18e6fc9a496b0df6166d61313c968531f0c45 (diff)
Lowercase username if 'login_lc' is set (#1488943)
-rw-r--r--plugins/acl/acl.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php
index e69fa6a1e..ab7c8ceec 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' => 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;
+ }
}