feat(auth): toggle visibilidad de contrasena con icono de ojo v20.9

This commit is contained in:
unknown
2026-10-13 11:20:50 -06:00
parent ed7989a280
commit b5e421cf25
4 changed files with 136 additions and 16 deletions
+16
View File
@@ -677,6 +677,22 @@ function quickFillLogin(username, password) {
handleLoginSubmit();
}
function togglePasswordVisibility(inputId, btn) {
const input = document.getElementById(inputId);
if (!input) return;
const isPassword = input.type === 'password';
input.type = isPassword ? 'text' : 'password';
if (btn) {
btn.title = isPassword ? 'Ocultar contraseña' : 'Ver contraseña';
btn.setAttribute('aria-label', btn.title);
btn.style.color = isPassword ? '#0284c7' : '';
btn.innerHTML = isPassword
? '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" x2="22" y1="2" y2="22"/></svg>'
: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>';
}
}
window.togglePasswordVisibility = togglePasswordVisibility;
async function handleLoginSubmit(event) {
if (event) event.preventDefault();
const username = document.getElementById('loginUsername').value.trim();