diff options
author | pierreozoux <pierre@ozoux.net> | 2017-11-09 14:48:01 +0300 |
---|---|---|
committer | pierreozoux <pierre@ozoux.net> | 2017-11-09 14:49:26 +0300 |
commit | 2c97cca9fff03f65d3378ad24f0c2815811b33e6 (patch) | |
tree | e8673c534c6e7a46b4a5b169f2a00fb9cee3d0e4 | |
parent | 733a248ef84c506e26d68f24110531466675b2e4 (diff) |
Add possibility to login with email on imap
-rw-r--r-- | user_external/lib/imap.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/user_external/lib/imap.php b/user_external/lib/imap.php index 4c5c57a78..b7bde1bd5 100644 --- a/user_external/lib/imap.php +++ b/user_external/lib/imap.php @@ -46,8 +46,21 @@ class OC_User_IMAP extends \OCA\user_external\Base { return false; } + $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; |