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
|
@ -53,7 +53,8 @@ function GetApp () {
|
|||
userDB: userDB,
|
||||
jsonResponse: false,
|
||||
exceptions: [
|
||||
'/favicon.ico'
|
||||
'/favicon.ico',
|
||||
'/getVeteranPw'
|
||||
]
|
||||
}))
|
||||
app.use(express.static('modules/qmining/public'))
|
||||
|
@ -172,6 +173,13 @@ function GetApp () {
|
|||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
app.get('/getVeteranPw', function (req, res) {
|
||||
res.render('veteranPw', {
|
||||
cid: req.query.cid
|
||||
})
|
||||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
app.get('*', function (req, res) {
|
||||
res.status(404).render('404')
|
||||
})
|
||||
|
|
117
modules/qmining/views/veteranPw.ejs
Normal file
117
modules/qmining/views/veteranPw.ejs
Normal file
|
@ -0,0 +1,117 @@
|
|||
|
||||
<html>
|
||||
<body bgcolor="#212127">
|
||||
<head>
|
||||
<title>Frylabs</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.6" />
|
||||
<style>
|
||||
.center {
|
||||
width: 440px;
|
||||
height: 340px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
overflow: auto;
|
||||
|
||||
text-align: center;
|
||||
}
|
||||
.text {
|
||||
font-size: 18px;
|
||||
color: white;
|
||||
margin: 20px;
|
||||
}
|
||||
.title {
|
||||
font-size: 50px;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
}
|
||||
.inputContainer {
|
||||
width: 100%;
|
||||
}
|
||||
.showpwContainer {
|
||||
color: white;
|
||||
width: 40px;
|
||||
cursor: pointer;
|
||||
}
|
||||
input[type=text], input[type=password] {
|
||||
width: 100%;
|
||||
padding: 12px 20px;
|
||||
margin: 8px 0;
|
||||
box-sizing: border-box;
|
||||
border: 2px solid #fff;
|
||||
text-align: center;
|
||||
}
|
||||
input[type=text], input[type=password]:focus {
|
||||
border: 2px solid #000;
|
||||
}
|
||||
button {
|
||||
width: 100px;
|
||||
background-color: #9999ff;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 16px 32px;
|
||||
text-decoration: none;
|
||||
margin: 4px 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<div class='center'>
|
||||
<div class='title'>
|
||||
Frylabs
|
||||
</div>
|
||||
<div id='text' class='text'>
|
||||
Másold be ide régi kliens ID-d, és az alapján jelszót ad. Ezt csak egyszer teheted meg, a
|
||||
kapott jelszót tuti helyre írd le!
|
||||
</div>
|
||||
<div id='form'>
|
||||
<div class='inputContainer'>
|
||||
<input type='text' id='cid' name='pw' autocomplete="off"/>
|
||||
</div>
|
||||
<input type='hidden' name='redirect' value='asd' autocomplete="off"/>
|
||||
<button id='sendButton' onclick="GetVeteranPW(this)">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
function HandleResp (resp) {
|
||||
const textNode = document.getElementById('text')
|
||||
document.getElementById('sendButton').innerText = 'Submit'
|
||||
if (resp.result === 'success') {
|
||||
document.getElementById('form').style.display = 'none'
|
||||
textNode.innerText = 'Password:'
|
||||
const pwDiv = document.createElement('div')
|
||||
pwDiv.innerText = resp.pw
|
||||
pwDiv.style.fontSize = '20px'
|
||||
textNode.appendChild(pwDiv)
|
||||
} else {
|
||||
textNode.innerText = resp.msg
|
||||
}
|
||||
}
|
||||
|
||||
async function GetVeteranPW(button) {
|
||||
button.innerText = '...'
|
||||
const rawResponse = await fetch('http://api.frylabs.net/getveteranpw', {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
cid: document.getElementById('cid').value
|
||||
})
|
||||
})
|
||||
rawResponse.json()
|
||||
.then((resp) => {
|
||||
HandleResp(resp)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue