fix log in issue

This commit is contained in:
2025-12-28 06:05:27 +01:00
parent a9ad5bc2ad
commit 0c5f801854
2 changed files with 40 additions and 35 deletions

View File

@@ -8,7 +8,7 @@
<h2>User Management</h2>
<button class="btn btn-primary" onclick="openModal('createUserModal')">+ Create User</button>
</div>
<table class="user-table">
<thead>
<tr>
@@ -31,12 +31,15 @@
<span class="badge badge-user">User</span>
{% endif %}
</td>
<td>{{ user.created_at.strftime('%Y-%m-%d %H:%M') }}</td>
<td>{{ user.created_at.strftime('%Y-%m-%d %H:%M') if user.created_at else 'N/A' }}</td>
<td>
<button class="btn btn-sm btn-primary" onclick="openResetPasswordModal({{ user.id }}, '{{ user.username }}')">Reset Password</button>
<button class="btn btn-sm btn-primary"
onclick="openResetPasswordModal({{ user.id }}, '{{ user.username }}')">Reset Password</button>
{% if user.id != current_user.id %}
<form method="POST" action="{{ url_for('admin.delete_user', user_id=user.id) }}" style="display: inline;">
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Delete user {{ user.username }}?')">Delete</button>
<form method="POST" action="{{ url_for('admin.delete_user', user_id=user.id) }}"
style="display: inline;">
<button type="submit" class="btn btn-sm btn-danger"
onclick="return confirm('Delete user {{ user.username }}?')">Delete</button>
</form>
{% endif %}
</td>
@@ -92,25 +95,25 @@
</div>
<script>
function openModal(modalId) {
document.getElementById(modalId).classList.add('active');
}
function closeModal(modalId) {
document.getElementById(modalId).classList.remove('active');
}
function openResetPasswordModal(userId, username) {
document.getElementById('resetUsername').textContent = username;
document.getElementById('resetPasswordForm').action = `/admin/users/${userId}/reset-password`;
openModal('resetPasswordModal');
}
// Close modal when clicking outside
window.onclick = function(event) {
if (event.target.classList.contains('modal')) {
event.target.classList.remove('active');
function openModal(modalId) {
document.getElementById(modalId).classList.add('active');
}
function closeModal(modalId) {
document.getElementById(modalId).classList.remove('active');
}
function openResetPasswordModal(userId, username) {
document.getElementById('resetUsername').textContent = username;
document.getElementById('resetPasswordForm').action = `/admin/users/${userId}/reset-password`;
openModal('resetPasswordModal');
}
// Close modal when clicking outside
window.onclick = function (event) {
if (event.target.classList.contains('modal')) {
event.target.classList.remove('active');
}
}
}
</script>
{% endblock %}
{% endblock %}