|
Lines 1-6
Link Here
|
|
|
1 |
function create_show_password_toggle(loop_counter) { |
| 2 |
const container = document.createElement('div'); |
| 3 |
container.className = 'show-password-toggle'; |
| 4 |
|
| 5 |
const checkbox = document.createElement('input'); |
| 6 |
checkbox.type = 'checkbox'; |
| 7 |
checkbox.className = 'show-password-toggle-checkbox'; |
| 8 |
checkbox.id = `show-password-toggle-checkbox-${loop_counter}`; |
| 9 |
|
| 10 |
const label = document.createElement('label'); |
| 11 |
label.className = 'show-password-toggle-label'; |
| 12 |
label.htmlFor = checkbox.id; |
| 13 |
label.textContent = " " + __('Show password'); |
| 14 |
|
| 15 |
container.appendChild(checkbox); |
| 16 |
container.appendChild(label); |
| 17 |
|
| 18 |
return container; |
| 19 |
} |
| 20 |
|
| 1 |
document.addEventListener("DOMContentLoaded", function() { |
21 |
document.addEventListener("DOMContentLoaded", function() { |
| 2 |
const local_logins = document.querySelectorAll('.local-login'); |
22 |
const local_logins = document.querySelectorAll('.local-login'); |
| 3 |
local_logins.forEach( (local_login) => { |
23 |
local_logins.forEach( (local_login, i) => { |
|
|
24 |
let show_password_toggle_node = create_show_password_toggle(i); |
| 25 |
local_login.querySelector("input[type='password']").after(show_password_toggle_node); |
| 4 |
const password_field = local_login.querySelector('#password,#mpassword'); |
26 |
const password_field = local_login.querySelector('#password,#mpassword'); |
| 5 |
const toggle_box = local_login.querySelector('input.show-password-toggle-checkbox'); |
27 |
const toggle_box = local_login.querySelector('input.show-password-toggle-checkbox'); |
| 6 |
if (password_field && toggle_box){ |
28 |
if (password_field && toggle_box){ |
| 7 |
- |
|
|