From 34ee8ee686a999b0e4be63714e005b173bb7c592 Mon Sep 17 00:00:00 2001 From: EDeev Date: Sun, 7 Dec 2025 01:33:28 +0300 Subject: [PATCH] v. 1.4 --- main/views.py | 3 ++- static/css/components.css | 39 +++++++++++++++++++++++++++++++++++++++ static/js/main.js | 20 ++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/main/views.py b/main/views.py index b4b2c8f..96e225a 100644 --- a/main/views.py +++ b/main/views.py @@ -384,7 +384,8 @@ def register_view(request): return render(request, 'auth/register.html', { 'form': form, - 'page_title': 'Регистрация — deev.space' + 'page_title': 'Регистрация — deev.space', + 'smartcaptcha_client_key': settings.SMARTCAPTCHA_CLIENT_KEY }) diff --git a/static/css/components.css b/static/css/components.css index 518359e..0197a47 100644 --- a/static/css/components.css +++ b/static/css/components.css @@ -474,4 +474,43 @@ textarea.form-control { .empty-state p { margin-bottom: var(--space-lg); +} + +/* Password Toggle Button */ +.password-input-wrapper { + position: relative; +} + +.password-input-wrapper .form-control { + padding-right: 3rem; +} + +.password-toggle { + position: absolute; + right: 0; + top: 0; + height: 100%; + width: 3rem; + background: none; + border: none; + color: var(--text-muted); + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + transition: var(--transition); + font-size: 1rem; +} + +.password-toggle:hover { + color: var(--primary-color); +} + +.password-toggle:focus { + outline: none; + color: var(--primary-color); +} + +.password-toggle i { + pointer-events: none; } \ No newline at end of file diff --git a/static/js/main.js b/static/js/main.js index 36cfd1d..56b23b7 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -549,4 +549,24 @@ }); } + // ===== Password Visibility Toggle ===== + window.togglePasswordVisibility = function(inputId, button) { + const input = document.getElementById(inputId); + const icon = button.querySelector('i'); + + if (!input) return; + + if (input.type === 'password') { + input.type = 'text'; + icon.classList.remove('fa-eye'); + icon.classList.add('fa-eye-slash'); + button.setAttribute('aria-label', 'Скрыть пароль'); + } else { + input.type = 'password'; + icon.classList.remove('fa-eye-slash'); + icon.classList.add('fa-eye'); + button.setAttribute('aria-label', 'Показать пароль'); + } + }; + })(); \ No newline at end of file