Files
theoldfitz/admin/login.js
T
David Dyer 242c5165e1 Refactor admin panel: enhance user management and security features
- Added role-based access control for user management links in admin navigation.
- Improved user account display with a dedicated account link.
- Implemented form submission confirmation for delete actions in the admin interface.
- Introduced a password visibility toggle on the login page.
- Added login throttling to prevent brute-force attacks, recording failed attempts.
- Created a CLI script for creating an admin user, replacing the previous hardcoded admin credentials.
- Updated database schema to support login attempt tracking.
- Enhanced user editing functionality, allowing role changes with restrictions.
- Improved modal handling for user actions, ensuring better focus management.
- Added styles for new account management page and improved modal transitions.
2026-10-25 12:58:19 -04:00

20 lines
655 B
JavaScript

// Login page: show/hide password toggle. Both icons are in the markup;
// this just flips which one is hidden, so no HTML is built in JS.
const btn = document.getElementById('btn-toggle-login-password');
const input = document.getElementById('password');
if (btn && input) {
const eyeOpen = btn.querySelector('.js-eye-open');
const eyeOff = btn.querySelector('.js-eye-off');
btn.addEventListener('click', () => {
const show = input.type === 'password';
input.type = show ? 'text' : 'password';
btn.setAttribute('aria-label', show ? 'Hide password' : 'Show password');
eyeOpen.hidden = show;
eyeOff.hidden = !show;
input.focus();
});
}