Hallo
We are setting up Owncloud for a diverse community.
Each group has its own domain with email addresses.
I have setup IMAP authentication.
In our mail system, each username is their email address (e.g. firstname.lastname@organization.de).
From App: user_external with IMAP auth does not work from within the owncloud client · Issue #302 · owncloud-archive/apps · GitHub I learned how to create a group (in our case “organization”) and add the person to that group.
But I did not find a way to set the user’s email address in Owncloud.
Can you tell me how that function is called?
Thanks
Michael
My code today from /apps/user_external/lib/imap.php:
public function checkPassword($uid, $password) {
if (!function_exists('imap_open')) {
OCP\Util::writeLog('user_external', 'ERROR: PHP imap extension is not installed', OCP\Util::ERROR);
return false;
}
$mbox = @imap_open($this->mailbox, $uid, $password, OP_HALFOPEN, 1);
imap_errors();
imap_alerts();
if($mbox !== FALSE) {
imap_close($mbox);
$uid = mb_strtolower($uid);
$this->storeUser($uid);
/// NEW
//$this->setEMailAddress($uid, $uid); //does not work
//OC_User::setEMailAddress($uid, $uid); //does not work
if (preg_match('/([^@]+)@([^.]+)\.[^.]+$/', $uid, $matches)) { // username@domain.extension
$username=$matches[1];
$username=str_replace(".", " ", $username);
$domain=$matches[2];
$this->setDisplayName($uid, $username) ;
OC_Group::createGroup($domain);
OC_Group::addToGroup($uid, $domain);
}
// END NEW
return $uid;
}else{
return false;
}
}
Server configuration
Operating system:
Ubuntu
Web server:
Apache
Database:
mySQL
PHP version:
7
ownCloud version (see ownCloud admin page):
ownCloud 9.1.0 (stable)
Updated from an older ownCloud or fresh install:
Fresh
ownCloud log (data/owncloud.log, see How to find webserver or OC logfile / enable php logfile):
Special configuration (external storage, external authentication, reverse proxy, server-side-encryption):
Integrity status for oC9+
Login as admin user into your ownCloud and access
http://example.com/index.php/settings/integrity/failed
paste the results here.
No errors have been found.