File: /var/www/html/CW-techs/wp-content/themes/cw-techs/js/password-toggle.js
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll('.eye-icon').forEach(function(eyeIcon) {
eyeIcon.addEventListener('click', function() {
var input = this.closest('.form-group').querySelector('input[type="password"], input[type="text"]');
var icon = this.querySelector('img');
if (input.type === 'password') {
input.type = 'text';
icon.src = passwordToggleVars.eyeClose;
// icon.src = passwordToggleVars.eyeOpen;
} else {
input.type = 'password';
// icon.src = passwordToggleVars.eyeClose;
icon.src = passwordToggleVars.eyeOpen;
}
});
});
});
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll('.eye-ico').forEach(function(eyeIcon) {
eyeIcon.addEventListener('click', function() {
var input = this.closest('.form-group').querySelector('input[type="password"], input[type="text"]');
var icon = this.querySelector('img');
if (input.type === 'password') {
input.type = 'text';
icon.src = passwordToggleVars.eyeClose;
// icon.src = passwordToggleVars.eyeOpen;
} else {
input.type = 'password';
// icon.src = passwordToggleVars.eyeClose;
icon.src = passwordToggleVars.eyeOpen;
}
});
});
});
// // Validate Password Strength
// function validatePassword() {
// let password = document.getElementById("password").value;
// let passwordError = document.getElementById("password-error");
// let regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{6,}$/;
// if (password === "") {
// passwordError.textContent = "Password is required.";
// } else if (password.length < 6) {
// passwordError.textContent = "Password must be at least 6 characters.";
// } else if (!regex.test(password)) {
// passwordError.textContent = "Password must contain uppercase, lowercase, number, and special character.";
// } else {
// passwordError.textContent = "";
// }
// }
// // Validate Confirm Password
// function validateConfirmPassword() {
// let password = document.getElementById("password").value;
// let confirmPassword = document.getElementById("confirm_password").value;
// let confirmError = document.getElementById("confirm-password-error");
// if (confirmPassword === "") {
// confirmError.textContent = "Confirm Password is required.";
// } else if (confirmPassword !== password) {
// confirmError.textContent = "Passwords do not match!";
// } else {
// confirmError.textContent = "";
// }
// }