{% extends "root.html" %}
{% block content %}
<div class="space-y-6 text-left">
<h2 class="text-2xl font-bold text-accent">Invites</h2>
<p class="opacity-70 text-sm">
Generate an invite link to bring someone onto {{ app_name }}. Share the URL —
they can register through it directly.
</p>
<form method="post" action="/invites" class="card bg-base-200 p-4 grid grid-cols-1 md:grid-cols-3 gap-2 items-end">
<label class="form-control md:col-span-1">
<span class="label-text text-xs">Restrict to email (optional)</span>
<input class="input input-bordered input-sm" type="email" name="email" placeholder="friend@example.com"/>
</label>
<label class="form-control md:col-span-1">
<span class="label-text text-xs">Days valid</span>
<input class="input input-bordered input-sm" type="number" min="1" name="days" placeholder="7"/>
</label>
<button class="btn btn-primary btn-sm md:col-span-1" type="submit">Generate invite</button>
</form>
{% if invites | length == 0 %}
<p class="opacity-70 text-sm">You haven't created any invites yet.</p>
{% else %}
<div class="overflow-x-auto">
<table class="table table-sm">
<thead>
<tr><th>Status</th><th>Email</th><th>Expires</th><th>Invite link</th></tr>
</thead>
<tbody>
{% for inv in invites %}
{% set expired = (inv.expires_at | string) < (now | string) %}
<tr class="{% if inv.is_used or expired %}opacity-50{% endif %}">
<td>
{% if inv.is_used %}<span class="badge badge-neutral badge-sm">Used</span>
{% elif expired %}<span class="badge badge-warning badge-sm">Expired</span>
{% else %}<span class="badge badge-success badge-sm">Active</span>{% endif %}
</td>
<td>{{ inv.email or "—" }}</td>
<td><code class="text-xs">{{ inv.expires_at }}</code></td>
<td>
{% if inv.is_used or expired %}
<code class="text-xs opacity-60">{{ inv.token }}</code>
{% else %}
<input class="input input-bordered input-xs w-full" readonly
value="/register?token={{ inv.token }}" onclick="this.select()"/>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
{% endblock %}
neiam
/fieri-forever
the flavortown lunch engine
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
2.3 KiB · text
History
25c4237