File size: 1,687 Bytes
e4fd6e0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | /**
* profile-page.js β Profile page interactions
* Handles: pw-fields toggle, eye toggles, strength meter
* NOTE: AJAX password-change is still handled by profile.js (legacy)
* Depends on: auth-shared.js
*/
document.addEventListener('DOMContentLoaded', function () {
/* ββ Change-password field toggle ββ */
const pwFields = document.getElementById('pwFields');
const pwToggleBtn = document.getElementById('pwToggleBtn');
const pwCancelBtn = document.getElementById('pwCancelBtn');
if (pwToggleBtn && pwFields) {
pwToggleBtn.addEventListener('click', function () {
pwFields.classList.add('active');
pwToggleBtn.style.display = 'none';
});
}
if (pwCancelBtn && pwFields) {
pwCancelBtn.addEventListener('click', function () {
pwFields.classList.remove('active');
if (pwToggleBtn) pwToggleBtn.style.display = '';
const form = document.getElementById('changePasswordForm');
if (form) form.reset();
const msg = document.getElementById('pwMessage');
if (msg) { msg.className = ''; msg.textContent = ''; }
// Reset strength bar
const bar = document.getElementById('profilePwBar');
const text = document.getElementById('profilePwText');
if (bar) { bar.className = 'pw-strength-fill'; }
if (text) { text.className = 'pw-strength-text'; text.textContent = ''; }
});
}
/* ββ Eye toggles ββ */
makePasswordToggle('toggleCur', 'currentPassword', 'eyeCur');
makePasswordToggle('toggleNew', 'newPassword', 'eyeNew');
/* ββ Strength meter on new password ββ */
passwordStrengthMeter('newPassword', 'profilePwBar', 'profilePwText');
});
|