From 1af723ca68e2558232ef4c4eb5a7c8f41a07bd0c Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 15 Mar 2014 07:08:58 -0400 Subject: Add a button to reveal/hide password I add a button on the configure user interface to reveal the password for 2 seconds and hide it after that period. See #442 I am not sure if the fallback unicode text for the icon is correct. I can not make it work. --- app/Models/Themes.php | 1 + app/views/configure/users.phtml | 2 ++ p/scripts/main.js | 12 ++++++++++++ p/themes/icons/key.svg | 7 +++++++ 4 files changed, 22 insertions(+) create mode 100644 p/themes/icons/key.svg diff --git a/app/Models/Themes.php b/app/Models/Themes.php index c7099a1df..ed746b7e9 100644 --- a/app/Models/Themes.php +++ b/app/Models/Themes.php @@ -77,6 +77,7 @@ class FreshRSS_Themes extends Minz_Model { 'down' => '▽', 'favorite' => '★', 'help' => 'ⓘ', + 'key' => '⚿', 'link' => '↗', 'login' => '🔒', 'logout' => '🔓', diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtml index 1a02b0e90..fdc94cd18 100644 --- a/app/views/configure/users.phtml +++ b/app/views/configure/users.phtml @@ -21,6 +21,7 @@
/> +
@@ -178,6 +179,7 @@
+
diff --git a/p/scripts/main.js b/p/scripts/main.js index 799d46625..57618c29b 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -998,6 +998,17 @@ function init_feed_observers() { }); }; +function init_password_observers() { + $('input[type="password"] + a.btn.toggle-password').on('click', function(e){ + e.preventDefault(); + var passwordField = $(this).siblings('input[type="password"]'); + passwordField.attr('type','text'); + setTimeout(function(){ + passwordField.attr('type','password'); + },2000); + }); +}; + function init_all() { if (!(window.$ && window.url_freshrss && ((!full_lazyload) || $.fn.lazyload))) { if (window.console) { @@ -1030,6 +1041,7 @@ function init_all() { } else { init_share_observers(); init_feed_observers(); + init_password_observers(); } if (window.console) { diff --git a/p/themes/icons/key.svg b/p/themes/icons/key.svg new file mode 100644 index 000000000..9193f4552 --- /dev/null +++ b/p/themes/icons/key.svg @@ -0,0 +1,7 @@ + + + + + + + -- cgit v1.2.3