{{ template "page" . }}
{{ define "main" }}
{{ template "navbar" . }}
<section class="container apps">
<h2>Authorized Apps</h2>
<p>You have granted {{ len .Tokens }} client{{ if not (eq (len .Tokens) 1) }}s{{ end }} access.</p>
{{ if gt (len .Tokens) 0 }}
<table>
<thead>
<tr>
<th>Client</th>
<th>Authorized</th>
<th>Scope</th>
<th></th>
</tr>
</thead>
<tbody>
{{ range .Tokens }}
<tr>
<td><a href="{{ .ClientID }}">{{ .ClientID }}</a></td>
<td><time datetime="{{ .CreatedAt.Format "2006-01-02T15:04:05Z07:00" }}">{{ .CreatedAt.Format "2 Jan 2006" }}</time></td>
<td>{{ .Scope }}</td>
<td class="no-padding"><form action="/revoke?id={{ .Token }}&state={{ $.State }}" method="post">
<button type="submit">Revoke</button>
</form></td>
</tr>
{{ end }}
</tbody>
</table>
{{ end }}
<h2>Generate Token</h2>
<form method="post" action="/generate">
<input name="state" value="{{ .State }}" hidden />
<div class="control">
<label for="client_id">Client ID</label>
<input id="client_id" name="client_id" />
</div>
<div class="control">
<label for="scope">Scope (space separated list)</label>
<input id="scope" name="scope" />
</div>
<div class="control">
<button type="submit">Create</button>
</div>
</form>
<h2>Forget</h2>
<p>Click the button below to delete all information associated with <strong>{{ .Me }}</strong>.</p>
<form action="/forget" method="post">
<button type="submit">Forget</button>
</form>
</section>
{{ end }}