[Pass-reset_script] Form and script now generate the form in format that is required by the backend
This commit is contained in:
parent
d1c46e152d
commit
b80aa303ac
2 changed files with 15 additions and 7 deletions
|
@ -17,9 +17,17 @@ formEl.addEventListener('submit', () => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const formData = new FormData(formEl);
|
const formData = new FormData(formEl);
|
||||||
if(formData.get("newPW") === formData.get("newPWConfirm")){
|
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 {
|
} else {
|
||||||
alert("Shit");
|
//TODO: Change this to changing a div in html
|
||||||
|
alert("Failure")
|
||||||
}
|
}
|
||||||
console.log({ object });
|
|
||||||
});
|
});
|
|
@ -6,10 +6,10 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form id="reset">
|
<form id="reset">
|
||||||
<label for="uid">Username</label>
|
<label for="user">Username</label>
|
||||||
<input type="text" id="uid" name="uid" /> <br />
|
<input type="text" id="user" name="user" /> <br />
|
||||||
<label for="oldPw">Old Password</label>
|
<label for="pass">Old Password</label>
|
||||||
<input type="password" id="oldPw" name="oldPW" /> <br />
|
<input type="password" id="pass" name="pass" /> <br />
|
||||||
<label for="newPW1">New Password</label>
|
<label for="newPW1">New Password</label>
|
||||||
<input type="password" id="newPW1" name="newPW" /> <br />
|
<input type="password" id="newPW1" name="newPW" /> <br />
|
||||||
<label for="newPW2">Confirm</label>
|
<label for="newPW2">Confirm</label>
|
||||||
|
|
Loading…
Reference in a new issue