|
| 1 | +{% extends "base.html" %} |
| 2 | + |
| 3 | +{% block content %} |
| 4 | +<div class="container"> |
| 5 | + <div class="admin-header"> |
| 6 | + <h2>User Management</h2> |
| 7 | + <button class="btn-primary" onclick="showCreateUserModal()">Add New User</button> |
| 8 | + </div> |
| 9 | + |
| 10 | + <div class="users-table"> |
| 11 | + <table id="usersTable"> |
| 12 | + <thead> |
| 13 | + <tr> |
| 14 | + <th>Username</th> |
| 15 | + <th>Role</th> |
| 16 | + <th>2FA Status</th> |
| 17 | + <th>Created</th> |
| 18 | + <th>Last Login</th> |
| 19 | + <th>Actions</th> |
| 20 | + </tr> |
| 21 | + </thead> |
| 22 | + <tbody id="usersList"> |
| 23 | + <tr><td colspan="6">Loading users...</td></tr> |
| 24 | + </tbody> |
| 25 | + </table> |
| 26 | + </div> |
| 27 | +</div> |
| 28 | + |
| 29 | +<!-- Create/Edit User Modal --> |
| 30 | +<div id="userModal" class="modal" style="display: none;"> |
| 31 | + <div class="modal-content"> |
| 32 | + <h3 id="modalTitle">Create New User</h3> |
| 33 | + <form id="userForm"> |
| 34 | + <input type="hidden" id="userId" value=""> |
| 35 | + |
| 36 | + <div class="form-group"> |
| 37 | + <label for="username">Username</label> |
| 38 | + <input type="text" id="username" name="username" required> |
| 39 | + </div> |
| 40 | + |
| 41 | + <div class="form-group"> |
| 42 | + <label for="password">Password</label> |
| 43 | + <div class="password-input-group"> |
| 44 | + <input type="password" id="password" name="password"> |
| 45 | + <button type="button" onclick="generatePassword()">Generate</button> |
| 46 | + <button type="button" onclick="togglePasswordVisibility()">Show</button> |
| 47 | + </div> |
| 48 | + <small id="passwordHint">Leave empty to keep current password</small> |
| 49 | + </div> |
| 50 | + |
| 51 | + <div class="form-group"> |
| 52 | + <label> |
| 53 | + <input type="checkbox" id="is_admin" name="is_admin"> |
| 54 | + Administrator |
| 55 | + </label> |
| 56 | + </div> |
| 57 | + |
| 58 | + <div class="form-group" id="reset2faGroup" style="display: none;"> |
| 59 | + <label> |
| 60 | + <input type="checkbox" id="reset_2fa" name="reset_2fa"> |
| 61 | + Reset 2FA |
| 62 | + </label> |
| 63 | + </div> |
| 64 | + |
| 65 | + <div class="modal-actions"> |
| 66 | + <button type="submit" class="btn-primary">Save</button> |
| 67 | + <button type="button" onclick="closeUserModal()">Cancel</button> |
| 68 | + </div> |
| 69 | + </form> |
| 70 | + </div> |
| 71 | +</div> |
| 72 | + |
| 73 | +<script src="{{ url_for('static', filename='admin.js') }}"></script> |
| 74 | +{% endblock %} |
0 commit comments