feature: login and my page

This commit is contained in:
antv
2026-07-02 15:42:47 +07:00
parent c993f848cb
commit 89790539b7
41 changed files with 1062 additions and 769 deletions
+48
View File
@@ -25,3 +25,51 @@ window.openDeleteModal = function(msnv, url) {
window.openModal('deleteModal');
}
};
window.togglePasswordVisibility = function(inputId, button) {
const input = document.getElementById(inputId);
if (!input) return;
const eyeOpen = button.querySelector('.eye-icon-open');
const eyeClosed = button.querySelector('.eye-icon-closed');
if (input.type === 'password') {
input.type = 'text';
button.setAttribute('aria-label', 'Hide password');
if (eyeOpen) eyeOpen.classList.remove('hidden');
if (eyeClosed) eyeClosed.classList.add('hidden');
} else {
input.type = 'password';
button.setAttribute('aria-label', 'Show password');
if (eyeOpen) eyeOpen.classList.add('hidden');
if (eyeClosed) eyeClosed.classList.remove('hidden');
}
};
document.addEventListener('DOMContentLoaded', () => {
const loginForm = document.querySelector('form[action$="/login"]');
if (loginForm) {
loginForm.addEventListener('submit', (e) => {
const submitBtn = loginForm.querySelector('button[type="submit"]');
if (submitBtn) {
if (submitBtn.disabled) {
e.preventDefault();
return;
}
submitBtn.disabled = true;
const originalText = submitBtn.textContent.trim();
submitBtn.dataset.originalText = originalText;
submitBtn.innerHTML = `
<svg class="animate-spin -ml-1 mr-2 h-4 w-4 text-white inline-block" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
<span>${originalText}</span>
`;
}
});
}
});