From 64de86dcf7933fcf9e3bcac723e69ec2e3728a07 Mon Sep 17 00:00:00 2001 From: John Crisp Date: Tue, 8 Jul 2025 11:07:29 +0200 Subject: [PATCH] Work on multi password fix --- .../public/koozali/js/sme-password.js | 78 +++++++++- .../AdminLTE/templates/userpassword.html.ep | 144 +++++++++--------- smeserver-manager-AdminLTE.spec | 7 +- 3 files changed, 151 insertions(+), 78 deletions(-) diff --git a/root/usr/share/smanager/themes/AdminLTE/public/koozali/js/sme-password.js b/root/usr/share/smanager/themes/AdminLTE/public/koozali/js/sme-password.js index bbf7479..7ec14b0 100644 --- a/root/usr/share/smanager/themes/AdminLTE/public/koozali/js/sme-password.js +++ b/root/usr/share/smanager/themes/AdminLTE/public/koozali/js/sme-password.js @@ -5,9 +5,78 @@ $(document).ready(function () { let pass = togglePassword; if (pass) { - togglePassword.addEventListener("click", function () { - // toggle the type attribute + togglePassword.addEventListener("click", function () { + // toggle the type attribute + const type = password.getAttribute("type") === "password" ? "text" : "password"; + password.setAttribute("type", type); + // toggle the eye icon + if (type === "text") { + $(this).removeClass("bi-eye"); + $(this).addClass("bi-eye-slash"); + } else { + $(this).removeClass("bi-eye-slash"); + $(this).addClass("bi-eye"); + } + }); + } +}); + +$(document).ready(function () { + + // Get the fields + const toggle = document.querySelector("#togglePasswords"); + const passwords = document.querySelectorAll('[type="password"]'); + + + // listen for click events on the toggle + toggle.addEventListener("click", function () { + // loop through each password field + for (let password of passwords) { + // if toggle is checked, change type to "text" + // otherwise, change it back to "password" + if (toggle.checked) { + password.type = "text"; + } else { + password.type = "password"; + } + } + }); + +}); + +$(document).ready(function () { + // For each password input + $('.sme-password').each(function () { + // Create a new container + //alert("sme-password"); + //var $inputContainer = $('
'); + + // Move the input into the new container + //$(this).wrap($inputContainer); + + // Create the toggle image + //var $togglePassword = $('Show Password'); + + // Append the toggle image to the container + //$(this).after($togglePassword); + }); + + $('.toggle-password').on('click', function () { + + alert("toggle-password"); + // Find the associated password field + var input = $(this).siblings('.sme-password'); + + // Toggle the type attribute between password and text + //var inputType = input.attr('type') === 'password' ? 'text' : 'password'; + //input.attr('type', inputType); + + // Toggle the icon source based on the input type + //var iconSrc = inputType === 'password' ? 'images/visible.png' : 'images/visible-slash.png'; + //$(this).attr('src', iconSrc); + const type = password.getAttribute("type") === "password" ? "text" : "password"; + password.setAttribute("type", type); // toggle the eye icon if (type === "text") { @@ -17,6 +86,9 @@ $(document).ready(function () { $(this).removeClass("bi-eye-slash"); $(this).addClass("bi-eye"); } + }); -} + }); + + diff --git a/root/usr/share/smanager/themes/AdminLTE/templates/userpassword.html.ep b/root/usr/share/smanager/themes/AdminLTE/templates/userpassword.html.ep index 4d6baf7..9467396 100644 --- a/root/usr/share/smanager/themes/AdminLTE/templates/userpassword.html.ep +++ b/root/usr/share/smanager/themes/AdminLTE/templates/userpassword.html.ep @@ -4,117 +4,115 @@
- % if (config->{debug} == 1) { -

- %= dumper $c->current_route - %= dumper $pwd_datas -

+ % if (config->{debug} == 0) { +
+            <%= dumper $c->current_route %>
+            <%= dumper $pwd_datas %>
+        
% }

<%= l 'pwd_ACCOUNT_PASSWORD_CHANGE' %>

% if ( stash 'error' ) {
-
- %= $c->render_to_string(inline => stash 'error') +
+ <%= $c->render_to_string(inline => stash 'error') %>
- %} + % } - % my $btn = l('pwd_PASSWORD_CHANGE'); - % my $url = '/userpassword'; + % my $btn = l('pwd_PASSWORD_CHANGE'); + % my $url = '/userpassword';
- %= $c->render_to_string( inline => l('pwd_DESCRIPTION')); + <%= $c->render_to_string( inline => l('pwd_DESCRIPTION')); %>
% if ( $pwd_datas->{trt} eq 'RESET' ) { - % my $btn = l('pwd_PASSWORD_RESET'); - % my $url = '/userpasswordr'; - %= $c->render_to_string( inline => l('pwd_DESCRIPTION_RESET')); + % my $btn = l('pwd_PASSWORD_RESET'); + % my $url = '/userpasswordr'; + <%= $c->render_to_string( inline => l('pwd_DESCRIPTION_RESET')); %> % }
+ - %= form_for $url => (method => 'POST') => begin - - - - - - - - - - - - - -
- %= l 'pwd_YOUR_ACCOUNT' - - %=l 'USER_NAME' -
<%= $pwd_datas->{Account} %><%= $pwd_datas->{name} %>Not in pwd_datas-> name ? :-(
+
-
- - % if ( $pwd_datas->{trt} ne 'RESET' ) { -
- <%= l 'pwd_PASSWORD_OLD' %> +
+
+ +
+
+ +

+ % if ( $pwd_datas->{trt} ne 'RESET' ) { +
+
+ +
+
+ +
+
+ +
+
+
+ % } +
-
- +
+ +
+
+ +
+
+
- % } -
+
-
- <%= l 'pwd_PASSWORD_NEW' %> -
- -
- -
-
- +
+
+ +
+
+ +
+
+ +
-
-
+
-
- %=l 'pwd_PASSWORD_VERIFY_NEW' -
- -
- -
-
- +
+ Show All Passwords Test +
-
-
+
-
-
- + <%= hidden_field 'User' => $pwd_datas->{Account} %> + <%= hidden_field 'Trt' => $pwd_datas->{trt} %> + <%= hidden_field 'jwt' => $pwd_datas->{jwt} %> + +
+
+ +
-
- %= hidden_field 'User' => $pwd_datas->{Account} - %= hidden_field 'Trt' => $pwd_datas->{trt} - %= hidden_field 'jwt' => $pwd_datas->{jwt} - - % end +
diff --git a/smeserver-manager-AdminLTE.spec b/smeserver-manager-AdminLTE.spec index 13ea4c0..2e82a28 100644 --- a/smeserver-manager-AdminLTE.spec +++ b/smeserver-manager-AdminLTE.spec @@ -1,6 +1,6 @@ %define name smeserver-manager-AdminLTE %define version 11.0.0 -%define release 46 +%define release 47 Summary: AdminLTE is an html framework for admin consoles - this rpm adds it to smeserver manager2 Name: %{name} @@ -17,7 +17,7 @@ BuildArchitectures: noarch BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot BuildRequires: smeserver-devtools Requires: smeserver-release >= 11.0 -Requires: smeserver-manager >= 11.0.0-101 +Requires: smeserver-manager >= 11.0.0-104 Requires: smeserver-lib >= 11.0.0-13 Requires: e-smith-manager >= 2.4.0-22 @@ -29,6 +29,9 @@ AdminLTE is an html framework for admin consoles wget https://github.com/ColorlibHQ/AdminLTE/archive/master.zip %changelog +* Tue Jul 08 2025 John Crisp 11.0.0-47.sme +- Working on multipassword show/hide + * Mon Jul 07 2025 John Crisp 11.0.0-46.sme - Too fast on the build button and missed some files