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.

103 lines
4.6 KiB

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