76 lines
3.0 KiB
HTML
76 lines
3.0 KiB
HTML
<article id="profile-authenticators">
|
|
<h6>Authenticators</h6>
|
|
<p>The authenticator that started the session is indicated as active.</p>
|
|
<div class="overflow-auto">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Name</th>
|
|
<th scope="col">Last login</th>
|
|
<th scope="col">Action</th>
|
|
<th scope="col" class="created-modified">Created / Updated</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="token-table-body">
|
|
{% for hex_id, credential_data in data.credentials.items() %}
|
|
<tr id="profile-credential-{{ hex_id }}"
|
|
hx-trigger="htmx:afterRequest[event.detail.successful==true] from:#profile-credential-{{ hex_id }}"
|
|
hx-target="this"
|
|
hx-select="#profile-credential-{{ hex_id }}"
|
|
hx-swap="outerHTML"
|
|
hx-get="/profile/">
|
|
<th scope="row">
|
|
{% if session["cred_id"] == hex_id %}
|
|
<mark>in use</mark>
|
|
{% endif %}
|
|
<span _="install inlineHtmxRename()"
|
|
contenteditable
|
|
data-patch-parameter="friendly_name"
|
|
spellcheck="false"
|
|
hx-patch="/profile/credential/{{ hex_id }}"
|
|
hx-trigger="editContent">
|
|
{{- credential_data.friendly_name or 'John Doe' -}}
|
|
</span>
|
|
</th>
|
|
<td>
|
|
{% if credential_data.last_login %}
|
|
<span _="init js return new Date('{{ credential_data.last_login }}').toLocaleString() end then put result into me">{{ credential_data.last_login }}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<a href="#" role="button" class="button-red"
|
|
hx-confirm="Delete token?"
|
|
_="install confirmButton"
|
|
hx-trigger="confirmedButton throttle:200ms"
|
|
hx-delete="/profile/credential/{{ hex_id }}">
|
|
Remove
|
|
</a>
|
|
<a href="#" role="button" class="{{ "outline" if not credential_data.active else ""}}"
|
|
hx-patch="/profile/credential/{{ hex_id }}"
|
|
hx-vals='js:{"active": {{ "true" if not credential_data.active else "false"}}}'
|
|
hx-params="active">
|
|
{{ "Disabled" if not credential_data.active else "Enabled"}}
|
|
</a>
|
|
</td>
|
|
<td class="created-modified">
|
|
<small _="init js return new Date('{{- credential_data.created -}}').toLocaleString() end then put result into me">{{- credential_data.created -}}</small>
|
|
{% if credential_data.created != credential_data.updated %}
|
|
<br>✏️ <small _="init js return new Date('{{- credential_data.updated -}}').toLocaleString() end then put result into me">{{- credential_data.updated -}}</small>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<button type="submit" hx-post="/auth/register/webauthn/options"
|
|
data-loading-disable
|
|
id="register"
|
|
hx-target="this"
|
|
hx-swap="innerHTML">
|
|
Add authenticator
|
|
</button>
|
|
|
|
</article>
|