refactoring

This commit is contained in:
Roland Gruber 2023-01-16 19:46:17 +01:00
parent 62cd388287
commit 38b9e3d7a8
3 changed files with 13 additions and 12 deletions

View file

@ -458,20 +458,20 @@ function checkPasswordStrength(fieldID, ajaxURL, tokenName, tokenValue) {
* @param fieldID input field ID
*/
function checkPasswordStrengthHandleReply(data, fieldID) {
var field = jQuery('#' + fieldID);
const field = document.getElementById(fieldID);
if (data.result === true) {
field.removeClass('markFail');
field.addClass('markOk');
field.prop('title', '');
field.classList.remove('markFail');
field.classList.add('markOk');
field.title = '';
}
else if (field.val() == '') {
field.removeClass('markFail');
field.removeClass('markOk');
else if (field.value == '') {
field.classList.remove('markFail');
field.classList.remove('markOk');
}
else {
field.addClass('markFail');
field.removeClass('markOk');
field.prop('title', data.result);
field.classList.add('markFail');
field.classList.remove('markOk');
field.title = data.result;
}
}

View file

@ -192,7 +192,7 @@ class Ajax {
*
* @param array<mixed> $input input parameters
*/
private static function managePasswordChange($input): void {
private static function managePasswordChange(array $input): void {
$sessionKey = htmlspecialchars($_GET['editKey']);
$return = $_SESSION[$sessionKey]->setNewPassword($input);
echo json_encode($return);
@ -203,7 +203,7 @@ class Ajax {
*
* @param array<mixed> $input input parameters
*/
private function checkPasswordStrength($input): void {
private function checkPasswordStrength(array $input): void {
$password = $input['password'];
$result = checkPasswordStrength($password, null, null);
echo json_encode(array("result" => $result));

View file

@ -35,3 +35,4 @@ parameters:
- '#Argument of an invalid type mixed supplied for foreach, only iterables are supported.#'
- '#Parameter \#2 \$args of function call_user_func_array expects array<int\|string, mixed>, mixed given.#'
- '#Parameter \#1 \$input of method LAM\\AJAX\\Ajax::managePasswordChange\(\) expects array, mixed given.#'
- '#Parameter \#1 \$input of method LAM\\AJAX\\Ajax::checkPasswordStrength\(\) expects array, mixed given.#'