2018-08-11 01:26:31 +02:00
|
|
|
extends layout
|
|
|
|
|
|
|
|
block content
|
|
|
|
p.
|
2018-08-11 01:41:17 +02:00
|
|
|
Bla bla bla qui devi scegliere una buona password
|
2018-08-11 01:26:31 +02:00
|
|
|
|
|
|
|
input#password(type="password", name="password")
|
|
|
|
p#crackTime
|
2018-08-11 01:41:17 +02:00
|
|
|
p#feedback
|
|
|
|
p#sequence
|
|
|
|
|
|
|
|
a#vinto(style="visibility: hidden") vinto
|
2018-08-11 01:26:31 +02:00
|
|
|
|
|
|
|
script(src="/js/zxcvbn.js")
|
|
|
|
script.
|
|
|
|
var crackTime = document.getElementById('crackTime')
|
2018-08-11 01:41:17 +02:00
|
|
|
var feedback = document.getElementById('feedback')
|
|
|
|
var sequence = document.getElementById('sequence')
|
|
|
|
var vinto = document.getElementById('vinto')
|
|
|
|
|
2018-08-11 01:26:31 +02:00
|
|
|
document.getElementById('password').oninput = function(ev, t) {
|
|
|
|
var ret = zxcvbn(this.value)
|
2018-08-11 01:41:17 +02:00
|
|
|
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';
|
|
|
|
}
|
|
|
|
}
|