2
2
* Copyright © 2015 Magento. All rights reserved.
3
3
* See COPYING.txt for license details.
4
4
*/
5
- /*jshint browser:true*/
5
+
6
+ /**
7
+ * jshint browser:true
8
+ */
6
9
define ( [
7
- " jquery" ,
8
- " Magento_Customer/js/zxcvbn"
9
- ] , function ( $ , zxcvbn ) {
10
- " use strict" ;
11
-
10
+ ' jquery' ,
11
+ ' Magento_Customer/js/zxcvbn'
12
+ ] , function ( $ , zxcvbn ) {
13
+ ' use strict' ;
14
+
12
15
$ . widget ( 'mage.passwordStrengthIndicator' , {
13
16
options : {
14
17
defaultClassName : 'password-strength-meter-' ,
@@ -19,15 +22,15 @@ define([
19
22
* Widget initialization
20
23
* @private
21
24
*/
22
- _create : function ( ) {
25
+ _create : function ( ) {
23
26
this . _bind ( ) ;
24
27
} ,
25
28
26
29
/**
27
30
* Event binding, will monitor scroll and resize events (resize events left for backward compat)
28
31
* @private
29
32
*/
30
- _bind : function ( ) {
33
+ _bind : function ( ) {
31
34
this . _on ( {
32
35
'change input[type="password"]' : this . _calculateStrength ,
33
36
'keyup input[type="password"]' : this . _calculateStrength ,
@@ -39,19 +42,20 @@ define([
39
42
* Calculate password strength
40
43
* @private
41
44
*/
42
- _calculateStrength : function ( ) {
43
- var password = this . _getPassword ( ) ;
44
- var score = zxcvbn ( password ) . score ;
45
- var className = this . _getClassName ( score ) ;
45
+ _calculateStrength : function ( ) {
46
+ var password = this . _getPassword ( ) ,
47
+ score = zxcvbn ( password ) . score ,
48
+ className = this . _getClassName ( score ) ;
49
+
46
50
this . _displayStrength ( className ) ;
47
51
} ,
48
52
49
53
/**
50
54
* Display strength
51
- * @param className
55
+ * @param { String } className
52
56
* @private
53
57
*/
54
- _displayStrength : function ( className ) {
58
+ _displayStrength : function ( className ) {
55
59
this . element . find ( '#' + this . options . passwordSrengthMeterId ) . removeClass ( ) ;
56
60
this . element . find ( '#' + this . options . passwordSrengthMeterId ) . addClass ( className ) ;
57
61
} ,
@@ -61,20 +65,20 @@ define([
61
65
* @returns {* }
62
66
* @private
63
67
*/
64
- _getPassword : function ( ) {
68
+ _getPassword : function ( ) {
65
69
return this . element . find ( 'input[type="password"]' ) . val ( ) ;
66
70
} ,
67
71
68
72
/**
69
73
* Get class name for score
70
- * @param score
71
- * @returns {string }
74
+ * @param { int } score
75
+ * @returns {String }
72
76
* @private
73
77
*/
74
- _getClassName : function ( score ) {
78
+ _getClassName : function ( score ) {
75
79
return this . options . defaultClassName + score ;
76
80
}
77
81
} ) ;
78
-
82
+
79
83
return $ . mage . passwordStrengthIndicator ;
80
84
} ) ;
0 commit comments