mailer: fix error handling

previous mailer code has no callback and thus no way to pass back errors.
now with asyncification it passes back the error
This commit is contained in:
Girish Ramakrishnan
2021-08-19 12:32:23 -07:00
parent ada7166bf8
commit 4cd5137292
10 changed files with 176 additions and 244 deletions

View File

@@ -556,7 +556,7 @@ async function sendPasswordResetByIdentifier(identifier, auditSource) {
await update(user, { resetToken, resetTokenCreationTime }, auditSource);
mailer.passwordReset(user);
await mailer.passwordReset(user);
}
async function notifyLoginLocation(user, ip, userAgent, auditSource) {
@@ -596,7 +596,7 @@ async function notifyLoginLocation(user, ip, userAgent, auditSource) {
await update(user, { loginLocations }, auditSource);
mailer.sendNewLoginLocation(user, newLoginLocation);
await mailer.sendNewLoginLocation(user, newLoginLocation);
}
async function setPassword(user, newPassword, auditSource) {
@@ -677,7 +677,7 @@ async function sendInvite(user, options) {
const directoryConfig = await settings.getDirectoryConfig();
mailer.sendInvite(user, options.invitor || null, inviteLink(user, directoryConfig));
await mailer.sendInvite(user, options.invitor || null, inviteLink(user, directoryConfig));
}
async function setupAccount(user, data, auditSource) {