Add possibility to login with email on imap
This commit is contained in:
15
lib/imap.php
15
lib/imap.php
@@ -46,8 +46,21 @@ class OC_User_IMAP extends \OCA\user_external\Base {
|
|||||||
return false;
|
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
|
// 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);
|
$pieces = explode('@', $uid);
|
||||||
if(count($pieces) == 1) {
|
if(count($pieces) == 1) {
|
||||||
$username = $uid . "@" . $this->domain;
|
$username = $uid . "@" . $this->domain;
|
||||||
|
|||||||
Reference in New Issue
Block a user