summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/lib/Controller/UsersController.php
diff options
context:
space:
mode:
authorSujith Haridasan <sujith.h@gmail.com>2020-10-05 16:09:00 +0530
committerSujith Haridasan <sujith.h@gmail.com>2020-10-05 16:47:57 +0530
commit62923a5e1eb5369dd5a89cd7b7928b13a8a61c6a (patch)
tree515704a105457eff38264abfbd6629f415df680c /apps/provisioning_api/lib/Controller/UsersController.php
parentb186852f9d387ac3517ae62804d5b81f178376c9 (diff)
downloadnextcloud-server-62923a5e1eb5369dd5a89cd7b7928b13a8a61c6a.tar.gz
nextcloud-server-62923a5e1eb5369dd5a89cd7b7928b13a8a61c6a.zip
Fix the user email issue while creating a user
When the user is created, the provisioning api was not adding the email address of the user when provided if the `send email to new user` is not set. Signed-off-by: Sujith Haridasan <sujith.h@gmail.com>
Diffstat (limited to 'apps/provisioning_api/lib/Controller/UsersController.php')
-rw-r--r--apps/provisioning_api/lib/Controller/UsersController.php26
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 14e835ce338..5903292ed6b 100644
--- a/apps/provisioning_api/lib/Controller/UsersController.php
+++ b/apps/provisioning_api/lib/Controller/UsersController.php
@@ -337,19 +337,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',
+ ]);
+ }
}
}