Closed kosli closed 7 years ago
Opinions? @MorrisJobke @LukasReschke 😅
I can't test this now. And I have currently other priorities than setting something up to test this 😢
I have kosli's code up and working for almost a year now - originally for oc, now for nextcloud. It works fine for me.
Just one addition: The user's created don't have an email address maintained even though it is known.
I added the following code to kosli's immediatelly before returning the $uid to set the email address:
if (filter_var($username, FILTER_VALIDATE_EMAIL)) {
$config = \OC::$server->getConfig();
if ($config->getUserValue($uid, 'settings', 'email')== '') {
$config->setUserValue($uid, 'settings', 'email', $username);
}
}
OCP\Util::writeLog('user_external', 'DEBUG: Created user '.$uid.' with email '.$username, OCP\Util::DEBUG);
Merging blindly because I trust you guys.
@ludgerb can you please create a pull request for your change? @nickvergessen thank you for merging. i run that version for multiple sites quite a while without problems.
@nickvergessen i tried to use your code in NC12, but it doesn't seem to work correctly. it sets the users email address in the oc_preferences table, but NOT in oc_accounts which seems to be the table and mail value that is used in e.g. the users "personal" settings page, or for sending out emails. i don't know which is the correct way to change a users email address? as e.g. the function here also sets only the mail address via setUserValue (https://github.com/nextcloud/server/blob/3f201ec7f3ed65ad672da14b55881ad4d678ce29/lib/private/User/User.php#L161)
any thoughts on that?
see https://github.com/nextcloud/apps/issues/1 and https://github.com/owncloud/apps/pull/2093