Roo/bootstrap/form/Password.js
authorleon <leon@roojs.com>
Wed, 10 May 2023 03:25:11 +0000 (11:25 +0800)
committerleon <leon@roojs.com>
Wed, 10 May 2023 03:25:11 +0000 (11:25 +0800)
Roo/bootstrap/form/Password.js

index 0defbbb..e0a43d6 100644 (file)
@@ -38,33 +38,31 @@ Roo.extend(Roo.bootstrap.form.Password, Roo.bootstrap.form.Input, {
 
         this.toggleEl().addClass('password-hidden');
 
-        this.toggleEl().on('click', this.onToggleClick, this);
-
-        // this.inputEl().on('click', this.onPasswordClick, this);
+        this.toggleEl().on('click', this.onToggleClick, this);;
     },
 
     toggleEl: function()
     {
         return this.el.select('button.password-toggle',true).first();
-    }
+    },
 
-    // onPasswordClick : function(e) 
-    // {
-    //     var input = this.inputEl();
+    onToggleClick : function(e) 
+    {
+        var input = this.inputEl();
 
-    //     if(e.getPageX() < input.getX() + input.getWidth() - 30) {
-    //         return;
-    //     }
+        if(e.getPageX() < input.getX() + input.getWidth() - 30) {
+            return;
+        }
 
-    //     input.removeClass(['password-visible', 'password-hidden']);
+        input.removeClass(['password-visible', 'password-hidden']);
 
-    //     if(input.attr('type') == 'password') {
-    //         input.attr('type', 'text');
-    //         input.addClass('password-visible');
-    //     }
-    //     else {
-    //         input.attr('type', 'password');
-    //         input.addClass('password-hidden');
-    //     }
-    // }
+        if(input.attr('type') == 'password') {
+            input.attr('type', 'text');
+            input.addClass('password-visible');
+        }
+        else {
+            input.attr('type', 'password');
+            input.addClass('password-hidden');
+        }
+    }
 });
\ No newline at end of file