Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Commit

Permalink
Update fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hardingadonis committed Dec 7, 2023
1 parent aaf0a6c commit 23ead1e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 41 deletions.
70 changes: 35 additions & 35 deletions src/main/webapp/assets/js/web/forgotChangePasswordHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if (changePasswordForm) {
});
}
},
error: function (xhr, status, error) {
error: function () {
Swal.fire({
title: "Lỗi!",
text: "Đã xảy ra lỗi trong quá trình xử lý yêu cầu. Vui lòng thử lại!",
Expand All @@ -56,50 +56,50 @@ if (changePasswordForm) {

});

passwordInput.addEventListener('input', function () {
removeSpaces(passwordInput);
});
$(".toggle-password").click(function () {
$(this).toggleClass("fa-eye fa-eye-slash");
input = $(this).parent().find("input");

confirmPasswordInput.addEventListener('input', function () {
removeSpaces(confirmPasswordInput);
if (input.attr("type") == "password") {
input.attr("type", "text");
} else {
input.attr("type", "password");
}
});
}

function removeSpaces(input) {
input.value = input.value.replace(/\s/g, '');
}
passwordInput.addEventListener('input', function () {
removeSpaces(passwordInput);
});

function isPasswordMatch(password, confirmPassword) {
return password === confirmPassword;
}
confirmPasswordInput.addEventListener('input', function () {
removeSpaces(confirmPasswordInput);
});

function isStrongPassword(password) {
if (password.length < 6) {
return false;
}
function removeSpaces(input) {
input.value = input.value.replace(/\s/g, '');
}

if (!/\d/.test(password)) {
return false;
}
function isPasswordMatch(password, confirmPassword) {
return password === confirmPassword;
}

if (!/[!@#$%^&*()_+{}\[\]:;<>,.?~\\/-]/.test(password)) {
return false;
}
function isStrongPassword(password) {
if (password.length < 6) {
return false;
}

if (!/[A-Z]/.test(password)) {
return false;
}
if (!/\d/.test(password)) {
return false;
}

return true;
if (!/[!@#$%^&*()_+{}\[\]:;<>,.?~\\/-]/.test(password)) {
return false;
}

$(".toggle-password").click(function () {
$(this).toggleClass("fa-eye fa-eye-slash");
input = $(this).parent().find("input");
if (!/[A-Z]/.test(password)) {
return false;
}

if (input.attr("type") == "password") {
input.attr("type", "text");
} else {
input.attr("type", "password");
}
});
return true;
}
12 changes: 6 additions & 6 deletions src/main/webapp/assets/js/web/forgotPasswordHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ if (forgotForm) {
emailInput.addEventListener('input', function () {
removeSpaces(emailInput);
});
}

function removeSpaces(input) {
input.value = input.value.replace(/\s/g, '');
}
function removeSpaces(input) {
input.value = input.value.replace(/\s/g, '');
}

function isValidEmail(email) {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}
function isValidEmail(email) {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}

0 comments on commit 23ead1e

Please sign in to comment.