mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-04-30 18:42:43 +02:00
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.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user