diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2020-11-10 08:51:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-10 08:51:35 +0100 |
commit | ceedb95a6bafafdf4410bbb45e0dc86135beda7f (patch) | |
tree | 4af9af318acc3ed4f673bad9794bba1b53e6ac59 /apps | |
parent | 4cd66463dc3366895bb13f664c08724c6cce12cf (diff) | |
parent | 17705b69aa5de3f1d154eedf57a0956588d05a36 (diff) | |
download | nextcloud-server-ceedb95a6bafafdf4410bbb45e0dc86135beda7f.tar.gz nextcloud-server-ceedb95a6bafafdf4410bbb45e0dc86135beda7f.zip |
Merge pull request #23202 from nextcloud/backport/23182/stable19
[stable19] Fix the user email issue while creating a user
Diffstat (limited to 'apps')
-rw-r--r-- | apps/provisioning_api/lib/Controller/UsersController.php | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index 07a1514dd1f..1fc8f2200be 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -335,19 +335,21 @@ class UsersController extends AUserData { } // Send new user mail only if a mail is set - if ($email !== '' && $this->config->getAppValue('core', 'newUser.sendEmail', 'yes') === 'yes') { + if ($email !== '') { $newUser->setEMailAddress($email); - try { - $emailTemplate = $this->newUserMailHelper->generateTemplate($newUser, $generatePasswordResetToken); - $this->newUserMailHelper->sendMail($newUser, $emailTemplate); - } catch (\Exception $e) { - // Mail could be failing hard or just be plain not configured - // Logging error as it is the hardest of the two - $this->logger->logException($e, [ - 'message' => "Unable to send the invitation mail to $email", - 'level' => ILogger::ERROR, - 'app' => 'ocs_api', - ]); + if ($this->config->getAppValue('core', 'newUser.sendEmail', 'yes') === 'yes') { + try { + $emailTemplate = $this->newUserMailHelper->generateTemplate($newUser, $generatePasswordResetToken); + $this->newUserMailHelper->sendMail($newUser, $emailTemplate); + } catch (\Exception $e) { + // Mail could be failing hard or just be plain not configured + // Logging error as it is the hardest of the two + $this->logger->logException($e, [ + 'message' => "Unable to send the invitation mail to $email", + 'level' => ILogger::ERROR, + 'app' => 'ocs_api', + ]); + } } } |