rifiniture

This commit is contained in:
lesion 2018-08-11 01:41:17 +02:00
parent faebdfb215
commit 97b3f8a830

View File

@ -2,15 +2,31 @@ extends layout
block content
p.
Bla bla bla qui devi scegliere una password
Bla bla bla qui devi scegliere una buona password
input#password(type="password", name="password")
p#crackTime
p#feedback
p#sequence
a#vinto(style="visibility: hidden") vinto
script(src="/js/zxcvbn.js")
script.
var crackTime = document.getElementById('crackTime')
var feedback = document.getElementById('feedback')
var sequence = document.getElementById('sequence')
var vinto = document.getElementById('vinto')
document.getElementById('password').oninput = function(ev, t) {
var ret = zxcvbn(this.value)
crackTime.innerHTML = ret.crack_times_display.offline_fast_hashing_1e10_per_second;
}
console.log(ret)
crackTime.innerHTML = 'A craccarla ci metto circa ' + ret.crack_times_display.offline_slow_hashing_1e4_per_second;
feedback.innerHTML = ret.feedback.suggestions.join(', ')
sequence.innerHTML = ret.sequence.map(s => s.pattern).join(' ,')
if (ret.score === 4){
vinto.style.visibility = 'visible';
} else {
vinto.style.visibility = 'hidden';
}
}