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.

80 lines
3.4 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" value="Delete">
  37. {% endif %}
  38. </form>
  39. </td>
  40. </tr>
  41. {% endfor %}
  42. </tbody>
  43. </table>
  44. </div>
  45. <hr>
  46. <div id="registeredUsers">
  47. <table>
  48. <thead>
  49. <th>User</th>
  50. <th>Registration Time</th>
  51. <th>Registration Code</th>
  52. </thead>
  53. <tbody>
  54. {% for registered_user in registered_users %}
  55. <tr>
  56. <td>{{ registered_user.username|tojson|safe }}</td>
  57. <td>{{ registered_user.registered_time|tojson|safe }}</td>
  58. <td>{{ registered_user.registration_code|tojson|safe }}</td>
  59. </tr>
  60. {% endfor %}
  61. </tbody>
  62. </table>
  63. </div>
  64. <hr>
  65. <div id="register">
  66. <form method="POST" action="/admin/add_registration_code">
  67. {{ add_registration_code_form.csrf_token }}
  68. <div class="row">
  69. {{ add_registration_code_form.expiration_time.label }} {{ add_registration_code_form.expiration_time() }}
  70. </div>
  71. <div class="row">
  72. {{ add_registration_code_form.max_usages.label }} {{ add_registration_code_form.max_usages(default="1", value="1") }}
  73. </div>
  74. <div class="formSubmit">
  75. <input type="submit" value="Add Token">
  76. </div>
  77. </form>
  78. </div>
  79. {% endblock %}