diff --git a/views/password.pug b/views/password.pug index 2e7cd4e..698e0ea 100644 --- a/views/password.pug +++ b/views/password.pug @@ -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; - } \ No newline at end of file + 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'; + } + }