A Python content management system designed for kirsle.net featuring a blog, comments and photo albums. https://rophako.kirsle.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.9KB

  1. {% extends "layout.html" %}
  2. {% block title %}Admin Center{% endblock %}
  3. {% block content %}
  4. <h1>User Management</h1>
  5. <h2>Create New User</h2>
  6. <form action="{{ url_for('admin.create_user') }}" method="POST">
  7. <input type="hidden" name="token" value="{{ csrf_token() }}">
  8. <fieldset>
  9. <legend>Create New User</legend>
  10. <strong>Username:</strong><br>
  11. <input type="text" size="40" name="username" placeholder="soandso"><p>
  12. <strong>Real name:</strong><br>
  13. <input type="text" size="40" name="name" placeholder="John Smith"><p>
  14. <strong>Passphrase:</strong><br>
  15. <input type="password" size="40" name="password1" placeholder="correct horse battery staple"><p>
  16. <strong>Confirm:</strong><br>
  17. <input type="password" size="40" name="password2" placeholder="correct horse battery staple"><p>
  18. <strong>Role:</strong><br>
  19. <select name="role">
  20. <option value="user" selected>User</option>
  21. <option value="admin">Admin</option>
  22. </select>
  23. <button type="submit">Create</button>
  24. </fieldset>
  25. <h2>User List</h2>
  26. <table class="table table-wide">
  27. <thead>
  28. <tr>
  29. <th width="100">User ID</th>
  30. <th width="300">Username</th>
  31. <th>Real name</th>
  32. <th width="100">Role</th>
  33. <th width="100">Log in</th>
  34. </tr>
  35. </thead>
  36. <tbody>
  37. {% for user in users %}
  38. <tr>
  39. <td>{{ user["uid"] }}</td>
  40. <td><a href="{{ url_for('admin.edit_user', uid=user['uid']) }}">{{ user["username"] }}</a></td>
  41. <td>{{ user["name"] }}</td>
  42. <td>{{ user["role"] }}</td>
  43. <td>
  44. {% if user["role"] != "admin" %}
  45. <a href="{{ url_for('admin.impersonate', uid=user['uid']) }}">Log in as</a>
  46. {% else %}
  47. n/a
  48. {% endif %}
  49. </td>
  50. </tr>
  51. {% endfor %}
  52. </tbody>
  53. </table>
  54. {% endblock %}