add optional welcome email for new users

When enabled, an email with the server URL and username will be sent to
created users. Requested in #38.
This commit is contained in:
Harvey Tindall
2021-01-24 15:19:58 +00:00
parent 406fef6595
commit ea262ca60b
12 changed files with 199 additions and 10 deletions
+12 -2
View File
@@ -214,13 +214,23 @@ export class accountsList {
_post("/users", send, (req: XMLHttpRequest) => {
if (req.readyState == 4) {
toggleLoader(button);
if (req.status == 200) {
if (req.status == 200 || (req.response["user"] as boolean)) {
window.notifications.customSuccess("addUser", window.lang.var("notifications", "userCreated", `"${send['username']}"`));
if (!req.response["email"]) {
window.notifications.customError("sendWelcome", window.lang.notif("errorSendWelcomeEmail"));
console.log("User created, but welcome email failed");
}
} else {
window.notifications.customError("addUser", window.lang.var("notifications", "errorUserCreated", `"${send['username']}"`));
}
if (req.response["error"] as String) {
console.log(req.response["error"]);
}
this.reload();
window.modals.addUser.close();
}
});
}, true);
}
deleteUsers = () => {