nextcloud / apps

🚚 This is an archive. Let us know if you want to take over maintainership of any of these apps
11 stars 29 forks source link

IMAP login can be restricted to a specific domain name. #15

Closed kosli closed 7 years ago

kosli commented 7 years ago

see https://github.com/nextcloud/apps/issues/1 and https://github.com/owncloud/apps/pull/2093

MariusBluem commented 7 years ago

Opinions? @MorrisJobke @LukasReschke 😅

MorrisJobke commented 7 years ago

I can't test this now. And I have currently other priorities than setting something up to test this 😢

ludgerb commented 7 years ago

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);

nickvergessen commented 7 years ago

Merging blindly because I trust you guys.

kosli commented 7 years ago

@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.

kosli commented 7 years ago

@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?