diff --git a/module/user/js/batchcreate.ui.js b/module/user/js/batchcreate.ui.js index f35e14f574..949d594f5a 100644 --- a/module/user/js/batchcreate.ui.js +++ b/module/user/js/batchcreate.ui.js @@ -37,3 +37,29 @@ function toggleNew(event) $newCompany.addClass('hidden'); } } + +/** + * Toggle checkbox and check password strength. + * + * @param event $event + * @access public + * @return void + */ +function togglePasswordStrength(event) +{ + const $target = $(event.target); + const $currentRow = $target.closest('tr'); + const password = $target.val(); + + let $passwordStrength = $currentRow.find('.passwordStrength'); + if(password == '') + { + $passwordStrength.addClass('hidden'); + $passwordStrength.html(''); + } + else + { + $passwordStrength.html(passwordStrengthList[computePasswordStrength(password)]); + $passwordStrength.removeClass('hidden'); + } +} diff --git a/module/user/ui/batchcreate.html.php b/module/user/ui/batchcreate.html.php index 128a1c5df6..871f804197 100644 --- a/module/user/ui/batchcreate.html.php +++ b/module/user/ui/batchcreate.html.php @@ -31,6 +31,7 @@ formBatchPanel set::headingClass('user-batchcreate-heading'), set::title($lang->user->batchCreate), on::change('[data-name="new"]', 'toggleNew'), + on::keyup('[data-name="password"]', 'togglePasswordStrength'), to::headingActions ( radioList @@ -158,7 +159,20 @@ formBatchPanel ( set::name('password'), set::label($lang->user->password), - set::control('input'), + set::control('inputGroup'), + inputGroup + ( + input + ( + set::name('password'), + set::value(''), + set::placeholder(zget($lang->user->placeholder->passwordStrength, $config->safe->mode, '')), + ), + span + ( + setClass('input-group-addon passwordStrength hidden'), + ), + ), set::width('200px'), ), formBatchItem