Implement login
This commit is contained in:
16
index.html
16
index.html
@@ -10,22 +10,16 @@
|
||||
<body>
|
||||
this is the base site
|
||||
|
||||
<a href="/newclient">Log in</a>
|
||||
|
||||
<br>
|
||||
|
||||
<input id="some_input" type="text" placeholder="dunno"/>
|
||||
<button id="btn_dunno">idk</button>
|
||||
<input id="username" type="text" placeholder="Joe"/>
|
||||
<button id="btn_register">idk</button>
|
||||
|
||||
<script>
|
||||
document.getElementById("btn_dunno").onclick = async function (e) {
|
||||
let text = document.getElementById("some_input").value;
|
||||
let data = {"username": text};
|
||||
document.getElementById("btn_register").onclick = function (e) {
|
||||
let username = document.getElementById("username").value;
|
||||
|
||||
await fetch('/newclient', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
window.location.replace(`/register/${encodeURIComponent(username)}`)
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user