Добавлен переключатель видимости пароля на всех страницах входа

This commit is contained in:
2025-12-14 01:56:50 +03:00
parent f03e750030
commit 835d6020e2
6 changed files with 29 additions and 67 deletions

View File

@@ -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');
}
}
});
});
});

View File

@@ -39,25 +39,4 @@
</div>
</div>
</div>
<script>
// Добавляем обработчик для показа/скрытия пароля
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.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');
}
});
});
</script>
{% endblock %}

View File

@@ -32,25 +32,4 @@
</div>
</div>
</div>
<script>
// Добавляем обработчик для показа/скрытия пароля
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.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');
}
});
});
</script>
{% endblock %}