camper/web/templates/admin/user/login-attempts.gohtml

65 lines
2.4 KiB
Plaintext

<!--
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
{{( pgettext "Login Attempts" "title" )}}
{{- end }}
{{ define "breadcrumb" -}}
<li><a href="/admin/users">{{( pgettext "Users" "title" )}}</a></li>
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/user.loginAttemptIndex*/ -}}
{{ template "filters-toggle" }}
<form class="filters" method="GET" action="/admin/users/login-attempts"
data-hx-target="main" data-hx-boost="true" data-hx-trigger="change,search,submit"
aria-labelledby="filters-toggle"
>
{{ with .Filters }}
<fieldset>
{{ with .FromDate -}}
<label>
{{( pgettext "From date" "input" )}}<br>
<input type="date"
name="{{ .Name }}" value="{{ .Val }}" {{ template "error-attrs" . }}
><br>
{{ template "error-message" . }}
</label>
{{- end }}
{{ with .ToDate -}}
<label>
{{( pgettext "To date" "input" )}}<br>
<input type="date"
name="{{ .Name }}" value="{{ .Val }}" {{ template "error-attrs" . }}
><br>
{{ template "error-message" . }}
</label>
{{- end }}
</fieldset>
{{ end }}
{{ if .Filters.HasValue }}
<a href="/admin/users/login-attempts" class="button">{{( pgettext "Reset" "action" )}}</a>
{{ end }}
</form>
<h2>{{( pgettext "Login Attempts" "title" )}}</h2>
{{ if .Attempts -}}
<table>
<thead>
<tr>
<th scope="col">{{( pgettext "Date" "header" )}}</th>
<th scope="col">{{( pgettext "Email" "header" )}}</th>
<th scope="col">{{( pgettext "IP Address" "header" )}}</th>
<th scope="col">{{( pgettext "Success" "header" )}}</th>
</tr>
</thead>
<tbody>
{{ template "results.gohtml" . }}
</tbody>
</table>
{{- else -}}
<p>{{( gettext "No logging attempts found." )}}</p>
{{- end }}
{{- end }}