diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-12-08 19:08:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-08 19:08:10 +0300 |
commit | f8fb4d98464254c037b330d4a17c9851b7bee823 (patch) | |
tree | 71aafcd014ce47d98de54f20fedeeea04b21d558 | |
parent | d93ee922810b008af2da244a5bccecc842544260 (diff) | |
parent | 1282e99ebb3c7785578e68d5977937237b63afce (diff) |
Merge pull request #41 from pierreozoux/imap-emailv13.0.0beta4v13.0.0beta3v13.0.0beta2v13.0.0RC3v13.0.0RC2v13.0.0RC1
Add possibility to login with email on imap
-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; |