<!--
 SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
 SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
    {{( pgettext "Login" "title" )}}
{{- end }}

{{ define "content" -}}
    {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/app.loginForm */ -}}
    <form method="post" action="/login">
        <input type="hidden" name="{{ .Redirect.Name}}" value="{{ .Redirect.Val }}">
        <h2>{{( pgettext "Login" "title" )}}</h2>
        {{ if .Error -}}
            <div class="error" role="alert">
                <p>{{ .Error }}</p>
            </div>
        {{- end }}
        <fieldset>
            {{ with .Email -}}
                <label>
                    {{( pgettext "Email" "input" )}}<br>
                    <input type="email" name="{{ .Name }}" value="{{ .Val }}"
                           autocomplete="username" required autofocus
                            {{ template "error-attrs" . }}><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            {{ with .Password -}}
                <label>
                    {{( pgettext "Password" "input" )}}<br>
                    <input type="password" name="{{ .Name }}" value="{{ .Val }}"
                           autocomplete="current-password" required
                            {{ template "error-attrs" . }}><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
        </fieldset>
        <footer>
            <button type="submit">{{( pgettext "Login" "action" )}}</button>
        </footer>
    </form>
{{- end }}
