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.
 
 
 
 
 

106 lines
4.6 KiB

{% extends 'base.html' %}
{% block header %}
<div class="pure-g text-center">
<div class="pure-u-1">
<h2>{% block title %}Admin Panel{% endblock %}</h2>
</div>
</div>
{% endblock %}
{% block content %}
<div class="pure-g text-center">
<div class="pure-u-1-24"></div>
<div class="pure-u-22-24">
<table class="pure-table pure-table-striped full-width">
<thead>
<tr>
<th>Registration Code</th>
<th>Creation Time</th>
<th>Expiration Time</th>
<th>Usages</th>
<th>Max Usages</th>
<th>Registration Link</th>
<th>Expire</th>
</tr>
</thead>
<tbody>
{% for registration_code in registration_codes %}
<tr>
<td>{{ registration_code.code|tojson|safe }}</td>
<td>{{ registration_code.creation_time|tojson|safe }}</td>
<td>{{ registration_code.expiration_time|tojson|safe }}</td>
<td>{{ registration_code.usages|tojson|safe }}</td>
<td>{{ registration_code.max_usages|tojson|safe }}</td>
<td>
{% if not registration_code.is_expired() and registration_code.has_available_uses() %}
<a href="/register?registrationCode={{ registration_code.code }}">link</a>
{% endif %}
<td class="borderless">
<form method="POST" action="/admin/expire_registration_code">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<input type="hidden" name="registration_code" value="{{ registration_code.code }}"/>
{% if not registration_code.is_expired() %}
<input type="submit" name="expire" value="Expire">
{% else %}
<input type="submit" name="delete"
value="Delete" {% if registration_code.usages > 0 %}
disabled="true" {% endif %}>
{% endif %}
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="pure-u-1-24"></div>
</div>
<div class="pure-g text-center pad-top">
<div class="pure-u-1-5"></div>
<div class="pure-u-3-5">
<table class="pure-table pure-table-striped full-width">
<thead>
<tr>
<th>Matrix ID</th>
<th>User</th>
<th>Registration Time</th>
<th>Registration Code</th>
</tr>
</thead>
<tbody>
{% for registered_user in registered_users %}
<tr>
<td>{{ registered_user.registered_user_id|tojson|safe }}</td>
<td>{{ registered_user.username|tojson|safe }}</td>
<td>{{ registered_user.registered_time|tojson|safe }}</td>
<td>{{ registered_user.registration_code|tojson|safe }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="pure-u-1-5"></div>
</div>
<div class="pure-g text-center pad-top">
<div class="pure-u-1-3"></div>
<div class="pure-u-1-3">
<form class="pure-form pure-form-aligned" method="POST" action="/admin/add_registration_code">
<fieldset>
{{ add_registration_code_form.csrf_token }}
<div class="pure-control-group">
{{ add_registration_code_form.expiration_time.label }} {{ add_registration_code_form.expiration_time() }}
</div>
<div class="pure-control-group">
{{ add_registration_code_form.max_usages.label }} {{ add_registration_code_form.max_usages(default="1", value="1") }}
</div>
<div class="pure-controls">
<input type="submit" value="Add Token">
</div>
</fieldset>
</form>
</div>
<div class="pure-u-1-3"></div>
</div>
{% endblock %}