password.js 786 B

12345678910111213141516171819202122
  1. moment.locale('it');
  2. var app = new Vue({
  3. el: '#passwordTest',
  4. data: {
  5. password: '',
  6. estimationScore: 0,
  7. score: ['inutile', 'pessima', 'brutta', 'così così', 'buona'],
  8. scoreColor: 'red',
  9. slowCrackTime: '',
  10. fastCrackTime: '',
  11. sequence: [],
  12. },
  13. methods: {
  14. checkStrength (e) {
  15. var estimation = zxcvbn(this.password, ['diocane', 'dioporco', 'porcodio', 'madonnacane'])
  16. this.estimationScore = estimation.score;
  17. this.slowCrackTime = moment.duration(estimation.crack_times_seconds.offline_slow_hashing_1e4_per_second, 'seconds').humanize();
  18. this.fastCrackTime = moment.duration(estimation.crack_times_seconds.offline_fast_hashing_1e10_per_second, 'seconds').humanize();
  19. this.sequence = estimation.sequence;
  20. },
  21. }
  22. })