-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
38 lines (26 loc) · 1021 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$(function() {
// $('[data-toggle="tooltip"]').tooltip();
$('.mask-password').on('click', function () {
$(this).toggleClass('active');
$('input.password').attr('type', function (index, attr) {
return (attr == 'password') ? 'text' : 'password';
});
});
var strengthClasses = [
'progress-bar-danger',
'progress-bar-warning',
'progress-bar-info',
'progress-bar-success',
'progress-bar-success'];
$('input.password').on('keyup', function () {
var strength = window.zxcvbn(this.value);
var strengthPercentage = 25 * strength.score;
strengthPercentage = strengthPercentage || 5;
$('#improved-password-strength').width(strengthPercentage + '%').attr('aria-valuenow', strengthPercentage);
//Remove old classes
for (var i = 0; i < strengthClasses.length; i++) {
$('#improved-password-strength').removeClass(strengthClasses[i]);
}
$('#improved-password-strength').addClass(strengthClasses[strength.score]);
});
});