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 * @param fieldID input field ID
*/ */
function checkPasswordStrengthHandleReply(data, fieldID) { function checkPasswordStrengthHandleReply(data, fieldID) {
var field = jQuery('#' + fieldID); const field = document.getElementById(fieldID);
if (data.result === true) { if (data.result === true) {
field.removeClass('markFail'); field.classList.remove('markFail');
field.addClass('markOk'); field.classList.add('markOk');
field.prop('title', ''); field.title = '';
} }
else if (field.val() == '') { else if (field.value == '') {
field.removeClass('markFail'); field.classList.remove('markFail');
field.removeClass('markOk'); field.classList.remove('markOk');
} }
else { else {
field.addClass('markFail'); field.classList.add('markFail');
field.removeClass('markOk'); field.classList.remove('markOk');
field.prop('title', data.result); field.title = data.result;
} }
} }

View file

@ -192,7 +192,7 @@ class Ajax {
* *
* @param array<mixed> $input input parameters * @param array<mixed> $input input parameters
*/ */
private static function managePasswordChange($input): void { private static function managePasswordChange(array $input): void {
$sessionKey = htmlspecialchars($_GET['editKey']); $sessionKey = htmlspecialchars($_GET['editKey']);
$return = $_SESSION[$sessionKey]->setNewPassword($input); $return = $_SESSION[$sessionKey]->setNewPassword($input);
echo json_encode($return); echo json_encode($return);
@ -203,7 +203,7 @@ class Ajax {
* *
* @param array<mixed> $input input parameters * @param array<mixed> $input input parameters
*/ */
private function checkPasswordStrength($input): void { private function checkPasswordStrength(array $input): void {
$password = $input['password']; $password = $input['password'];
$result = checkPasswordStrength($password, null, null); $result = checkPasswordStrength($password, null, null);
echo json_encode(array("result" => $result)); 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.#' - '#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 \#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::managePasswordChange\(\) expects array, mixed given.#'
- '#Parameter \#1 \$input of method LAM\\AJAX\\Ajax::checkPasswordStrength\(\) expects array, mixed given.#'