diff --git a/myproject/accounts/static/accounts/js/auth.js b/myproject/accounts/static/accounts/js/auth.js new file mode 100644 index 0000000..b926cf1 --- /dev/null +++ b/myproject/accounts/static/accounts/js/auth.js @@ -0,0 +1,25 @@ +// Authentication-related JavaScript functionality + +// Password visibility toggle handler +document.addEventListener('DOMContentLoaded', function() { + // Add click handlers to all password toggle buttons + document.querySelectorAll('.show-password-btn').forEach(button => { + button.addEventListener('click', function() { + const targetId = this.getAttribute('data-target'); + const targetInput = document.getElementById(targetId); + const icon = this.querySelector('i'); + + if (targetInput && icon) { + if (targetInput.type === 'password') { + targetInput.type = 'text'; + icon.classList.remove('bi-eye'); + icon.classList.add('bi-eye-slash'); + } else { + targetInput.type = 'password'; + icon.classList.remove('bi-eye-slash'); + icon.classList.add('bi-eye'); + } + } + }); + }); +}); diff --git a/myproject/accounts/templates/accounts/password_reset_confirm.html b/myproject/accounts/templates/accounts/password_reset_confirm.html index 1af9244..f5d67d0 100644 --- a/myproject/accounts/templates/accounts/password_reset_confirm.html +++ b/myproject/accounts/templates/accounts/password_reset_confirm.html @@ -39,25 +39,4 @@ - - {% endblock %} \ No newline at end of file diff --git a/myproject/accounts/templates/accounts/password_setup_confirm.html b/myproject/accounts/templates/accounts/password_setup_confirm.html index 894ea4b..a7e4af2 100644 --- a/myproject/accounts/templates/accounts/password_setup_confirm.html +++ b/myproject/accounts/templates/accounts/password_setup_confirm.html @@ -32,25 +32,4 @@ - - {% endblock %} diff --git a/myproject/templates/base.html b/myproject/templates/base.html index 56e56fa..1e0304a 100644 --- a/myproject/templates/base.html +++ b/myproject/templates/base.html @@ -54,6 +54,9 @@ + + + {% block extra_js %}{% endblock %} \ No newline at end of file diff --git a/myproject/templates/change_password.html b/myproject/templates/change_password.html index 275b7eb..d3dd4fa 100644 --- a/myproject/templates/change_password.html +++ b/myproject/templates/change_password.html @@ -32,25 +32,4 @@ - - {% endblock %} \ No newline at end of file diff --git a/myproject/templates/home.html b/myproject/templates/home.html index 6cfa088..2f1f110 100644 --- a/myproject/templates/home.html +++ b/myproject/templates/home.html @@ -31,10 +31,7 @@ -
- - -
+ {% include 'accounts/password_input.html' with field_name='password' field_label='Пароль' required=True %}