mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Added veteran pw request site, logging in prettying
This commit is contained in:
parent
03c54c7bd4
commit
b970b2eb30
4 changed files with 181 additions and 28 deletions
|
@ -21,6 +21,11 @@
|
|||
|
||||
text-align: center;
|
||||
}
|
||||
.text {
|
||||
font-size: 18px;
|
||||
color: white;
|
||||
margin: 20px;
|
||||
}
|
||||
.title {
|
||||
font-size: 50px;
|
||||
font-weight: bold;
|
||||
|
@ -45,7 +50,7 @@
|
|||
input[type=text], input[type=password]:focus {
|
||||
border: 2px solid #000;
|
||||
}
|
||||
input[type=button], input[type=submit], input[type=reset] {
|
||||
button {
|
||||
background-color: #9999ff;
|
||||
border: none;
|
||||
color: white;
|
||||
|
@ -60,16 +65,17 @@
|
|||
<div class='title'>
|
||||
Frylabs
|
||||
</div>
|
||||
<form action="http://api.frylabs.net/login" method="POST">
|
||||
<div id='text' class='text'>
|
||||
</div>
|
||||
<div id='form'>
|
||||
<div class='inputContainer'>
|
||||
<input type='password' id='pw' name='pw' autocomplete="off"/>
|
||||
<!-- <span onclick="ShowHidePW()" class='showpwContainer'>
|
||||
👁
|
||||
</span> -->
|
||||
</div>
|
||||
<input type='hidden' name='redirect' value=<%= redirect %> autocomplete="off"/>
|
||||
<input type='submit' value='Submit' formmethod='post' />
|
||||
</form>
|
||||
<button id='sendButton' onclick="Login(this)">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
|
@ -81,5 +87,35 @@
|
|||
x.type = "password";
|
||||
}
|
||||
}
|
||||
function HandleResp (resp) {
|
||||
console.log(resp)
|
||||
document.getElementById('sendButton').innerText = 'Submit'
|
||||
const textNode = document.getElementById('text')
|
||||
if (resp.result === 'success') {
|
||||
location.reload()
|
||||
textNode.innerText = resp.msg
|
||||
} else {
|
||||
textNode.innerText = resp.msg
|
||||
}
|
||||
}
|
||||
|
||||
async function Login(button) {
|
||||
button.innerText = '...'
|
||||
const rawResponse = await fetch('http://api.frylabs.net/login', {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
pw: document.getElementById('pw').value
|
||||
})
|
||||
})
|
||||
rawResponse.json()
|
||||
.then((resp) => {
|
||||
HandleResp(resp)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue