2
0
分叉 0
分叉自 cisti/facciamo
autodifesa-digitale-parte-1/js/password.js
2018-10-01 00:19:54 +02:00

22 行
786 B
JavaScript

moment.locale('it');
var app = new Vue({
el: '#passwordTest',
data: {
password: '',
estimationScore: 0,
score: ['inutile', 'pessima', 'brutta', 'così così', 'buona'],
scoreColor: 'red',
slowCrackTime: '',
fastCrackTime: '',
sequence: [],
},
methods: {
checkStrength (e) {
var estimation = zxcvbn(this.password, ['diocane', 'dioporco', 'porcodio', 'madonnacane'])
this.estimationScore = estimation.score;
this.slowCrackTime = moment.duration(estimation.crack_times_seconds.offline_slow_hashing_1e4_per_second, 'seconds').humanize();
this.fastCrackTime = moment.duration(estimation.crack_times_seconds.offline_fast_hashing_1e10_per_second, 'seconds').humanize();
this.sequence = estimation.sequence;
},
}
})