diff --git a/templates/login.html b/templates/login.html index b4ea84c..e395baa 100644 --- a/templates/login.html +++ b/templates/login.html @@ -8,12 +8,14 @@ {% block content %} {{ header.section(user) }} -
@@ -120,13 +135,18 @@ function sendToNextPage(e) { window.location.href = next; } else { - // non-2xx — mark all input groups as error const allFields = document.querySelectorAll('.floating-group'); - allFields.forEach(g => g.classList.add('error')); - - // Optional: you can show server message if present - // const errorText = await res.text(); - // console.error('Server error:', errorText); + let msg; + if (res.status === 403) { + // Аккаунт заблокирован — поля ввода ни при чём, показываем причину + msg = 'Ваш аккаунт заблокирован администратором.'; + try { const d = await res.json(); if (d && typeof d.detail === 'string') msg = d.detail; } catch (e) {} + allFields.forEach(g => g.classList.remove('error')); + } else { + msg = 'Неверный логин или пароль'; + allFields.forEach(g => g.classList.add('error')); + } + if (typeof showToast === 'function') showToast({ message: msg, status: 'error', duration: 9000 }); } } catch (err) { // Network or other unexpected error — mark fields as error @@ -179,6 +199,17 @@ function sendToNextPage(e) { pwd.focus(); }); + // Вход через Макс — бэкенд ещё не готов: уведомление, без перехода + var maxLoginBtn = document.querySelector('.login-social__btn--max'); + if (maxLoginBtn) { + maxLoginBtn.addEventListener('click', function (e) { + e.preventDefault(); + if (typeof showToast === 'function') { + showToast({ message: 'Вход через Макс — в процессе реализации', status: 'info', duration: 2800 }); + } + }); + } + {{ footer.section() }}