A simple web application that allows invitation based registration to a matrix instance
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.

83 lines
3.5 KiB

6 years ago
6 years ago
  1. {% extends 'base.html' %}
  2. {% block header %}
  3. <h1>{% block title %}Admin{% endblock %}</h1>
  4. {% endblock %}
  5. {% block content %}
  6. <div id="activeRegistrationCodes">
  7. <table>
  8. <thead>
  9. <th>Registration Code</th>
  10. <th>Creation Time</th>
  11. <th>Expiration Time</th>
  12. <th>Usages</th>
  13. <th>Max Usages</th>
  14. <th>Registration Link</th>
  15. <th>Expire</th>
  16. </thead>
  17. <tbody>
  18. {% for registration_code in registration_codes %}
  19. <tr>
  20. <td>{{ registration_code.code|tojson|safe }}</td>
  21. <td>{{ registration_code.creation_time|tojson|safe }}</td>
  22. <td>{{ registration_code.expiration_time|tojson|safe }}</td>
  23. <td>{{ registration_code.usages|tojson|safe }}</td>
  24. <td>{{ registration_code.max_usages|tojson|safe }}</td>
  25. <td>
  26. {% if not registration_code.is_expired() and registration_code.has_available_uses() %}
  27. <a href="/register?registrationCode={{ registration_code.code }}">link</a>
  28. {% endif %}
  29. <td class="borderless">
  30. <form method="POST" action="/admin/expire_registration_code">
  31. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
  32. <input type="hidden" name="registration_code" value="{{ registration_code.code }}"/>
  33. {% if not registration_code.is_expired() %}
  34. <input type="submit" name="expire" value="Expire">
  35. {% else %}
  36. <input type="submit" name="delete"
  37. value="Delete" {% if registration_code.usages > 0 %} disabled="true" {% endif %}>
  38. {% endif %}
  39. </form>
  40. </td>
  41. </tr>
  42. {% endfor %}
  43. </tbody>
  44. </table>
  45. </div>
  46. <hr>
  47. <div id="registeredUsers">
  48. <table>
  49. <thead>
  50. <th>Matrix ID</th>
  51. <th>User</th>
  52. <th>Registration Time</th>
  53. <th>Registration Code</th>
  54. </thead>
  55. <tbody>
  56. {% for registered_user in registered_users %}
  57. <tr>
  58. <td>{{ registered_user.registered_user_id|tojson|safe }}</td>
  59. <td>{{ registered_user.username|tojson|safe }}</td>
  60. <td>{{ registered_user.registered_time|tojson|safe }}</td>
  61. <td>{{ registered_user.registration_code|tojson|safe }}</td>
  62. </tr>
  63. {% endfor %}
  64. </tbody>
  65. </table>
  66. </div>
  67. <hr>
  68. <div id="register">
  69. <form method="POST" action="/admin/add_registration_code">
  70. {{ add_registration_code_form.csrf_token }}
  71. <div class="row">
  72. {{ add_registration_code_form.expiration_time.label }} {{ add_registration_code_form.expiration_time() }}
  73. </div>
  74. <div class="row">
  75. {{ add_registration_code_form.max_usages.label }} {{ add_registration_code_form.max_usages(default="1", value="1") }}
  76. </div>
  77. <div class="formSubmit">
  78. <input type="submit" value="Add Token">
  79. </div>
  80. </form>
  81. </div>
  82. {% endblock %}