mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
fix: report email as not sent to fe if it throws (#844)
This commit is contained in:
parent
c9f67cc209
commit
52d3e9eb77
@ -137,13 +137,22 @@ export default class UserAdminController extends Controller {
|
|||||||
user.email,
|
user.email,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let emailSent = false;
|
||||||
const emailConfigured = this.emailService.configured();
|
const emailConfigured = this.emailService.configured();
|
||||||
if (emailConfigured) {
|
if (emailConfigured) {
|
||||||
|
try {
|
||||||
await this.emailService.sendGettingStartedMail(
|
await this.emailService.sendGettingStartedMail(
|
||||||
createdUser.name,
|
createdUser.name,
|
||||||
createdUser.email,
|
createdUser.email,
|
||||||
inviteLink.toString(),
|
inviteLink.toString(),
|
||||||
);
|
);
|
||||||
|
emailSent = true;
|
||||||
|
} catch (e) {
|
||||||
|
this.logger.warn(
|
||||||
|
'email was configured, but sending failed due to: ',
|
||||||
|
e,
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.logger.warn(
|
this.logger.warn(
|
||||||
'email was not sent to the user because email configuration is lacking',
|
'email was not sent to the user because email configuration is lacking',
|
||||||
@ -153,7 +162,7 @@ export default class UserAdminController extends Controller {
|
|||||||
res.status(201).send({
|
res.status(201).send({
|
||||||
...createdUser,
|
...createdUser,
|
||||||
inviteLink,
|
inviteLink,
|
||||||
emailSent: emailConfigured,
|
emailSent,
|
||||||
rootRole,
|
rootRole,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user