start password level

This commit is contained in:
lesion 2018-08-11 01:26:31 +02:00
parent cbf0720493
commit faebdfb215
No known key found for this signature in database
GPG Key ID: 352918250B012177
4 changed files with 47 additions and 6 deletions

28
public/js/zxcvbn.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -20,14 +20,13 @@ router.get('/mail', render('mail'))
// level V (vpn -> read mail)
router.get('/vpn', fromTor, fromVpn, checkCountry, (req, res, next) => {
console.log('son qui dentro');
if (!req.fromTor && req.fromVpn) {
res.render('vpnok', req.geoinfo);
} else {
res.render('vpnnook', req.geoinfo);
}
// console.log('sono qui dentro?!?!');
// render('torok')
})
router.get('/password', render('password'))
module.exports = router

View File

@ -39,9 +39,7 @@ const checkCountry = (req, res, next) => {
const sourceIp = req.headers['x-forwarded-for'] || req.connection.remoteAddress
request(`http://ip-api.com/json/${sourceIp}`, (err, res, body) => {
if (!err && res.statusCode === 200) {
console.log(body);
req.geoinfo = JSON.parse(body);
console.log(req.geoinfo);
req.geoinfo = JSON.parse(body)
}
next()
})

16
views/password.pug Normal file
View File

@ -0,0 +1,16 @@
extends layout
block content
p.
Bla bla bla qui devi scegliere una password
input#password(type="password", name="password")
p#crackTime
script(src="/js/zxcvbn.js")
script.
var crackTime = document.getElementById('crackTime')
document.getElementById('password').oninput = function(ev, t) {
var ret = zxcvbn(this.value)
crackTime.innerHTML = ret.crack_times_display.offline_fast_hashing_1e10_per_second;
}