Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/apps.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-12-08 19:08:10 +0300
committerGitHub <noreply@github.com>2017-12-08 19:08:10 +0300
commitf8fb4d98464254c037b330d4a17c9851b7bee823 (patch)
tree71aafcd014ce47d98de54f20fedeeea04b21d558
parentd93ee922810b008af2da244a5bccecc842544260 (diff)
parent1282e99ebb3c7785578e68d5977937237b63afce (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.php17
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;