diff options
author | Sujith Haridasan <sujith.h@gmail.com> | 2020-10-05 13:39:00 +0300 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-10-05 22:34:19 +0300 |
commit | 17705b69aa5de3f1d154eedf57a0956588d05a36 (patch) | |
tree | 7ff9da8e01bd0e79d23986b209cbaf663241b3fc /apps/provisioning_api | |
parent | 3759bef671ba50f8b444151908d7d71b48548642 (diff) |
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')
-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', + ]); + } } } |