Add optional email confirmation

If enabled, a confirmation email will be sent before the user can create
their account.
This commit is contained in:
Harvey Tindall
2021-01-30 19:19:12 +00:00
parent 736c39840f
commit ee026714d4
26 changed files with 411 additions and 194 deletions
+10 -1
View File
@@ -8,6 +8,8 @@ interface formWindow extends Window {
modal: Modal;
code: string;
messages: { [key: string]: string };
confirmation: boolean;
confirmationModal: Modal
}
interface pwValString {
@@ -26,7 +28,10 @@ interface pwValStrings {
loadLangSelector("form");
window.modal = new Modal(document.getElementById("modal-success"));
window.modal = new Modal(document.getElementById("modal-success"), true);
if (window.confirmation) {
window.confirmationModal = new Modal(document.getElementById("modal-confirmation"), true);
}
declare var window: formWindow;
var defaultPwValStrings: pwValStrings = {
@@ -120,6 +125,10 @@ const create = (event: SubmitEvent) => {
toggleLoader(submitSpan);
if (req.status == 401) {
if (req.response["error"] as string) {
if (req.response["error"] == "confirmEmail") {
window.confirmationModal.show();
return;
}
const old = submitSpan.textContent;
if (req.response["error"] in window.messages) {
submitSpan.textContent = window.messages[req.response["error"]];