Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function setDisplayName($uid, $displayName) {
*
* @return void
*/
protected function storeUser($uid, $groups = []) {
protected function storeUser($uid, $groups = [], $email = '') {
if (!$this->userExists($uid)) {
$query = $this->db->getQueryBuilder();
$query->insert('users_external')
Expand All @@ -211,6 +211,11 @@ protected function storeUser($uid, $groups = []) {
$this->groupManager->createGroup($group)->addUser($createduser);
}
}

if ($email) {
$createduser = \OC::$server->getUserManager()->get($uid);
$createduser->setSystemEMailAddress($email);
Comment thread
brknkfr marked this conversation as resolved.
Outdated
}
}
}

Expand Down
5 changes: 4 additions & 1 deletion lib/IMAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public function checkPassword($uid, $password) {
$uid = str_replace('%40', '@', $uid);
}

// Get email if uid is a valid email address
if (filter_var($uid, FILTER_VALIDATE_EMAIL)) $email = mb_strtolower($uid);
Comment thread
brknkfr marked this conversation as resolved.
Outdated

$pieces = explode('@', $uid);
if ($this->domain !== '') {
if (count($pieces) === 1) {
Expand Down Expand Up @@ -107,7 +110,7 @@ public function checkPassword($uid, $password) {
if ($errorcode === 0) {
curl_close($ch);
$uid = mb_strtolower($uid);
$this->storeUser($uid, $groups);
$this->storeUser($uid, $groups, $email);
return $uid;
} elseif ($errorcode === CURLE_COULDNT_CONNECT
|| $errorcode === CURLE_SSL_CONNECT_ERROR
Expand Down
Loading