diff --git a/frontend/src/pages/auth/forgot-password.astro b/frontend/src/pages/auth/forgot-password.astro index ac5b4c0..f334862 100644 --- a/frontend/src/pages/auth/forgot-password.astro +++ b/frontend/src/pages/auth/forgot-password.astro @@ -70,7 +70,7 @@ import { SITE_URL } from '@constants'; if (!email) return; submitBtn.disabled = true; - submitBtn.textContent = 'Отправка...'; + submitBtn.classList.add('loading'); try { const response = await fetch('/api/auth/request-password-reset', { @@ -87,15 +87,18 @@ import { SITE_URL } from '@constants'; } else { const errorEl = document.getElementById('email-error'); if (errorEl) errorEl.textContent = data.error || 'Ошибка'; + submitBtn.disabled = false; + submitBtn.classList.remove('loading'); } } catch (err) { if (formError) { formError.textContent = 'Ошибка соединения'; formError.classList.remove('hidden'); } + submitBtn.disabled = false; + submitBtn.classList.remove('loading'); } finally { submitBtn.disabled = false; - submitBtn.textContent = 'Отправить ссылку'; } }); @@ -197,6 +200,31 @@ import { SITE_URL } from '@constants'; cursor: not-allowed; } + .btn-submit.loading { + position: relative; + color: transparent !important; + pointer-events: none; + } + + .btn-submit.loading::after { + content: ''; + position: absolute; + width: 20px; + height: 20px; + top: 50%; + left: 50%; + margin-left: -10px; + margin-top: -10px; + border: 2px solid #ffffff; + border-radius: 50%; + border-top-color: transparent; + animation: spin 0.8s linear infinite; + } + + @keyframes spin { + to { transform: rotate(360deg); } + } + .auth-messages { margin-top: 1.5rem; text-align: center; diff --git a/frontend/src/pages/auth/reset-password.astro b/frontend/src/pages/auth/reset-password.astro index 1b90c90..a96b6f5 100644 --- a/frontend/src/pages/auth/reset-password.astro +++ b/frontend/src/pages/auth/reset-password.astro @@ -57,15 +57,27 @@ const error = Astro.url.searchParams.get('error');