From 41da78f35a2a48a13cda7ebd41a30dbb001b796a Mon Sep 17 00:00:00 2001 From: Linty Date: Wed, 29 Apr 2026 16:21:37 +0200 Subject: [PATCH] (cp 33024bcc8) fixes #2555 toggle password links by user status Show copy/send password links by default but hide them for users with status 'generic'. Adds a change handler in fill_user_edit_properties to call toggle_send_copy_password when the status select changes, and implements toggle_send_copy_password(status) to show/hide #copy_password_link and #send_password_link accordingly. --- admin/themes/default/js/user_list.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/admin/themes/default/js/user_list.js b/admin/themes/default/js/user_list.js index 39c3f366f..8194224cf 100644 --- a/admin/themes/default/js/user_list.js +++ b/admin/themes/default/js/user_list.js @@ -1483,6 +1483,15 @@ function fill_user_edit_properties(user_to_edit, pop_in) { current_group_selectize.addItem(group.value); }); pop_in.find('.user-list-checkbox[name="hd_enabled"]').attr('data-selected', user_to_edit.enabled_high == 'true' ? '1' : '0'); + + // by default show copy_password_link and send_password_link + // but if the user status is generic just hide because these users + // aren't allowed to change their password by link + toggle_send_copy_password(user_to_edit.status); + $('#tab_properties .user-property-status .user-property-select').off('change').on('change', function() { + const status = $(this).val(); + toggle_send_copy_password(status); + }); } function fill_user_edit_preferences(user_to_edit, pop_in) { @@ -2473,3 +2482,11 @@ function set_main_user(user_id, new_username) { } }); } + +function toggle_send_copy_password(status) { + if ('generic' === status) { + $('#copy_password_link, #send_password_link').hide(); + } else { + $('#copy_password_link, #send_password_link').show(); + } +}