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.

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