if ( document.getElementsByClassName("credentials_input_password").length == 2 && document.getElementsByClassName("credentials_input_password")[1].getAttribute("name") == "_F5_verify_password" ) { const field1 = document.getElementsByClassName("credentials_input_password")[0]; const field2 = document.getElementsByClassName("credentials_input_password")[1]; const logonButton = document.getElementsByClassName("credentials_input_submit")[0]; logonButton.value = "Change"; logonButton.disabled = true; field2.disabled = true; field1.onfocus = () => { document.getElementById("password_complexity").style.display = "block"; }; field2.onfocus = () => { document.getElementById("password_match").style.display = "block"; document.getElementById("password_complexity").style.display = "none"; }; field2.onblur = () => { document.getElementById("password_match").style.display = "none"; }; field1.onkeyup = () => { const password = field1.value; const checks = { letter: /^[a-zA-Z]/.test(password), capital: /[A-Z]/.test(password), number: /\d/.test(password), length: password.length >= 12, symbol: /[^a-zA-Z0-9]/.test(password) }; for (let key in checks) { const elem = document.getElementById(key); elem.classList.toggle("valid", checks[key]); elem.classList.toggle("invalid", !checks[key]); } const validCount = Object.values(checks).filter(Boolean).length; const percent = Math.floor((validCount / Object.keys(checks).length) * 100); const pcbar = document.getElementById("pcbar"); pcbar.style.width = `${percent}%`; pcbar.innerHTML = percent > 0 ? `${percent}%` : ""; if (percent < 40) { pcbar.style.backgroundColor = "#dc3545"; } else if (percent < 70) { pcbar.style.backgroundColor = "#ffc107"; pcbar.style.color = "#000"; } else { pcbar.style.backgroundColor = "#28a745"; pcbar.style.color = "#fff"; } const allValid = Object.values(checks).every(Boolean); field2.disabled = !allValid; }; field2.onkeyup = () => { const match = document.getElementById("match"); const pmbar = document.getElementById("pmbar"); const isMatch = field1.value === field2.value; match.classList.toggle("valid", isMatch); match.classList.toggle("invalid", !isMatch); logonButton.disabled = !isMatch; pmbar.style.background = isMatch ? "linear-gradient(to bottom, #0d8f34, #4CAF50)" : "linear-gradient(to bottom, #fa8c05, red)"; pmbar.style.width = isMatch ? "100%" : "5%"; pmbar.innerHTML = isMatch ? "100%" : ""; }; } // UI Elements const tableFooter = document.getElementById("credentials_table_footer"); tableFooter.style.cssText = "vertical-align:top;"; let toolTip = "Password must contain the following:"; toolTip += '
Begin with a letter
'; toolTip += 'Include an uppercase letter
'; toolTip += 'Include a number
'; toolTip += 'At least 12 characters
'; toolTip += 'Include a special character
'; const passwordComplexity = document.createElement("div"); passwordComplexity.style.cssText = "position:relative;display:none;padding-left:15px;padding-right:20px;"; passwordComplexity.id = "password_complexity"; passwordComplexity.innerHTML += "Password requirements:"; passwordComplexity.innerHTML += 'Passwords match
'; const passwordMatch = document.createElement("div"); passwordMatch.style.cssText = "position:relative;display:none;padding-left:15px;padding-right:20px;"; passwordMatch.id = "password_match"; passwordMatch.innerHTML = "Password verification:"; passwordMatch.innerHTML += '