From b80aa303ac1f50753d547ad58bb6b7d9068efebd Mon Sep 17 00:00:00 2001 From: "eoghan.conlon" Date: Thu, 27 Jul 2023 18:19:45 +0100 Subject: [PATCH] [Pass-reset_script] Form and script now generate the form in format that is required by the backend --- src/PassReset/formHandler.js | 14 +++++++++++--- src/PassReset/index.html | 8 ++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/PassReset/formHandler.js b/src/PassReset/formHandler.js index a3f00ab..791bb4e 100644 --- a/src/PassReset/formHandler.js +++ b/src/PassReset/formHandler.js @@ -17,9 +17,17 @@ formEl.addEventListener('submit', () => { event.preventDefault(); const formData = new FormData(formEl); if(formData.get("newPW") === formData.get("newPWConfirm")){ - alert("This works"); + formData.delete("newPWConfirm"); + const newPW = formData.get("newPW"); + formData.delete("newPW"); + formData.append("field", "password"); + formData.append("value", newPW); + const object = Object.fromEntries(formData.entries()); + console.log({ object }); + //TODO: Change this to changing a div in html + alert("Success"); } else { - alert("Shit"); + //TODO: Change this to changing a div in html + alert("Failure") } - console.log({ object }); }); \ No newline at end of file diff --git a/src/PassReset/index.html b/src/PassReset/index.html index d2697c9..f9d1b0f 100644 --- a/src/PassReset/index.html +++ b/src/PassReset/index.html @@ -6,10 +6,10 @@
- -
- -
+ +
+ +