diff options
Diffstat (limited to 'res/setup.html')
| -rw-r--r-- | res/setup.html | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/res/setup.html b/res/setup.html index 8068a9d..546ee1b 100644 --- a/res/setup.html +++ b/res/setup.html @@ -19,17 +19,16 @@ <body> <main class="setup"> - <h1 class="setup-title">SyncTube</h1> - <p>Create your admin account</p> + <img class="welcome-image" src="img/welcome.webp" alt="Welcome to Dohee Cinema"> + <h1 class="setup-title">Welcome to the Dohee Cinema</h1> + <p>put in the password for entry</p> - <form id="setup-form" class="setup-form" action="/setup" method="POST"> - <input type="text" name="name" placeholder="Name"> + <form id="setup-form" class="setup-form"> <input type="password" name="password" placeholder="Password"> - <input type="password" name="confirmation" placeholder="Repeat password"> <div id="form-errors" class="form-errors"></div> - <button type="submit">Create</button> + <button type="submit">Enter</button> </form> </main> @@ -40,30 +39,24 @@ formElement.addEventListener("submit", function (e) { e.preventDefault(); - const { name, password, confirmation } = formElement.elements; + const { password } = formElement.elements; const payload = { - name: name.value, password: password.value, - passwordConfirmation: confirmation.value, - } + }; - fetch("/setup", { method: "POST", body: JSON.stringify(payload) }) + fetch("/gate", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }) .then(res => res.json()) .then(response => handleResponse(response)) .catch(() => handleResponse(null)); }, true); - function handleResponse(response) { - if (response.success) { - return window.location.reload(); + if (response && response.success === true) { + window.location.href = "/"; + return; } - const errors = !response - ? ["Unknown error"] - : (response.errors ?? []).map(item => item.error); - - showErrors(errorsElement, errors); + showErrors(errorsElement, ["Incorrect password. Not cool man"]); } function showErrors(container, errors) { |
