diff options
Diffstat (limited to 'user_external/lib/imap.php')
-rw-r--r-- | user_external/lib/imap.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/user_external/lib/imap.php b/user_external/lib/imap.php index d98b29953..e53fb4605 100644 --- a/user_external/lib/imap.php +++ b/user_external/lib/imap.php @@ -51,9 +51,22 @@ class OC_User_IMAP extends \OCA\user_external\Base { if (!(strpos($uid, '@') !== false) && (strpos($uid, '%40') !== false)) { $uid = str_replace("%40","@",$uid); } - + + $result = OC_DB::executeAudited( + 'SELECT `userid` FROM `*PREFIX*preferences`' + . ' WHERE `appid` = "settings" AND `configkey` = "email" AND `configvalue` = ?', + array($uid) + ); + $users = array(); + while ($row = $result->fetchRow()) { + $users[] = $row['userid']; + } + + if(count($users) === 1) { + $username = $uid; + $uid = $users[0]; // Check if we only want logins from ONE domain and strip the domain part from UID - if($this->domain != '') { + }elseif($this->domain != '') { $pieces = explode('@', $uid); if(count($pieces) == 1) { $username = $uid . "@" . $this->domain; |