add a basic website
This commit is contained in:
parent
c3abe6a284
commit
d12d7b87ec
6 changed files with 126 additions and 0 deletions
35
static/change.html
Normal file
35
static/change.html
Normal file
|
@ -0,0 +1,35 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>tResetter - cambio password</title>
|
||||
<link rel="stylesheet" href="css/mini-default.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>tResette - Cambia password</h1>
|
||||
<h2>Cambia password</h2>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-3"></div>
|
||||
<div class="col-sm-6">
|
||||
<input id="generate-label" readonly name="candidate-password" value="" />
|
||||
<button id="generate-btn">Genera</button>
|
||||
</div> <!-- col -->
|
||||
<div class="col-sm-3"></div>
|
||||
</div> <!-- row -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-4"></div>
|
||||
<div class="col-sm-4">
|
||||
<button id="accept-btn" disabled class="primary button">Accetta</button>
|
||||
</div>
|
||||
<div class="col-sm-4"></div>
|
||||
</div>
|
||||
</div><!-- container -->
|
||||
<script src="js/general.js" type="application/javascript"></script>
|
||||
<script src="js/change.js" type="application/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
1
static/css/mini-default.min.css
vendored
Normal file
1
static/css/mini-default.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
35
static/js/change.js
Normal file
35
static/js/change.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
async function onGenerate(evt) {
|
||||
let resp = await fetch('../generate', {
|
||||
method: 'POST',
|
||||
})
|
||||
console.log('ok', resp)
|
||||
data = await resp.json()
|
||||
console.log('got', data)
|
||||
document.getElementById("generate-label").value = data.password
|
||||
document.getElementById("accept-btn").removeAttribute('disabled')
|
||||
}
|
||||
async function onAccept(evt) {
|
||||
document.getElementById("generate-btn").setAttribute('disabled', 'disabled')
|
||||
let resp = await fetch('../change', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
password: document.getElementById("generate-label").value
|
||||
})
|
||||
})
|
||||
data = await resp.json()
|
||||
if(data.success === true) {
|
||||
// window.location.href = '../logout'
|
||||
true
|
||||
} else {
|
||||
document.getElementById("generate-btn").removeAttribute('disabled')
|
||||
document.getElementById("accept-btn").setAttribute('disabled', 'disabled')
|
||||
}
|
||||
}
|
||||
function initChange() {
|
||||
document.getElementById("generate-label").value = ""
|
||||
document.getElementById("accept-btn").setAttribute('disabled', 'disabled')
|
||||
document.getElementById("generate-btn").addEventListener('click', onGenerate, false)
|
||||
document.getElementById("accept-btn").addEventListener('click', onAccept, false)
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', initChange)
|
||||
|
0
static/js/general.js
Normal file
0
static/js/general.js
Normal file
19
static/js/login.js
Normal file
19
static/js/login.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
async function onSubmit(evt) {
|
||||
evt.preventDefault()
|
||||
|
||||
let resp = await fetch('../login', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
username: document.querySelector('#login-form input[name=username]').value,
|
||||
password: document.querySelector('#login-form input[name=password]').value,
|
||||
})
|
||||
})
|
||||
console.log('ok', resp)
|
||||
document.location.href = '../'
|
||||
|
||||
}
|
||||
|
||||
function initLogin() {
|
||||
document.getElementById("login-form").addEventListener('submit', onSubmit, false)
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', initLogin)
|
36
static/login.html
Normal file
36
static/login.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>tResetter - cambio password</title>
|
||||
<link rel="stylesheet" href="css/mini-default.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>tResette <small>Login</small></h1>
|
||||
|
||||
<form id="login-form">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-3"> <label for="username">Nome utente</label>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-9"> <input name="username" placeholder="utente@ondarossa.info" />
|
||||
</div>
|
||||
</div> <!-- row -->
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-3"> <label for="password">Password attuale</label>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-9"> <input name="password" type="password" />
|
||||
</div>
|
||||
</div> <!-- row -->
|
||||
|
||||
<button id="login-btn" class="primary button">Login</button><br/>
|
||||
</form>
|
||||
</div> <!-- row -->
|
||||
</div> <!-- col-sm-6 -->
|
||||
</div><!-- container -->
|
||||
|
||||
|
||||
<script src="js/general.js" type="application/javascript"></script>
|
||||
<script src="js/login.js" type="application/javascript"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue