fix(auth/users): corregir edicion de contraseñas de usuarios, cambio de contraseña y evitar pantalla en blanco
This commit is contained in:
@@ -38,11 +38,19 @@
|
||||
</div>
|
||||
|
||||
<div class="card-body p-4">
|
||||
<form method="POST">
|
||||
{% if error %}
|
||||
<div class="alert alert-danger alert-dismissible fade show mb-4" role="alert">
|
||||
<i class="bi bi-exclamation-triangle-fill me-2"></i>{{ error }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form method="POST" action="{% if user and user.id %}/admin/users/edit/{{ user.id }}{% else %}/admin/users/new{% endif %}">
|
||||
{% if user %}
|
||||
<input type="hidden" name="id" value="{{ user.id }}">
|
||||
{% endif %}
|
||||
|
||||
|
||||
<!-- SECCIÓN 1: IDENTIDAD Y DOCUMENTACIÓN -->
|
||||
<div class="mb-4">
|
||||
<h6 class="text-uppercase text-primary fw-bold small border-bottom pb-2 mb-3">
|
||||
@@ -164,12 +172,15 @@
|
||||
<div class="input-group">
|
||||
<span class="input-group-text bg-body-tertiary"><i class="bi bi-key"></i></span>
|
||||
<input type="password" class="form-control" id="password" name="password"
|
||||
{% if not user %}required{% endif %}
|
||||
{% if not user %}required minlength="6"{% else %}minlength="6"{% endif %}
|
||||
placeholder="{% if user %}Dejar en blanco para mantener{% else %}Mínimo 6 caracteres{% endif %}">
|
||||
<button class="btn btn-outline-secondary" type="button" id="togglePasswordBtn" title="Mostrar u ocultar contraseña">
|
||||
<i class="bi bi-eye" id="togglePasswordIcon"></i>
|
||||
</button>
|
||||
</div>
|
||||
{% if user %}
|
||||
<small class="text-muted d-block mt-1">
|
||||
Solo complete este campo si desea restablecer la contraseña del usuario.
|
||||
Solo complete este campo si desea restablecer la contraseña del usuario (mínimo 6 caracteres).
|
||||
</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -250,6 +261,17 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
docTypeSelect.addEventListener('change', updateDocHint);
|
||||
updateDocHint();
|
||||
}
|
||||
|
||||
var togglePasswordBtn = document.getElementById('togglePasswordBtn');
|
||||
var passwordInput = document.getElementById('password');
|
||||
var togglePasswordIcon = document.getElementById('togglePasswordIcon');
|
||||
if (togglePasswordBtn && passwordInput && togglePasswordIcon) {
|
||||
togglePasswordBtn.addEventListener('click', function() {
|
||||
var isPass = passwordInput.getAttribute('type') === 'password';
|
||||
passwordInput.setAttribute('type', isPass ? 'text' : 'password');
|
||||
togglePasswordIcon.className = isPass ? 'bi bi-eye-slash' : 'bi bi-eye';
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user