* Add passwordStrength tip for user::batchCreate.

This commit is contained in:
liumengyi
2023-06-29 18:34:36 +08:00
parent 1ec67b0e7c
commit 9dfadd11f0
2 changed files with 41 additions and 1 deletions
+26
View File
@@ -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');
}
}
+15 -1
View File
@@ -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