{* SPDX-FileCopyrightText: © 2021 Olivier Meunier SPDX-License-Identifier: AGPL-3.0-only *} {{ extends "./base" }} {{ import "/_libs/forms" }} {{ block title() }}{{ gettext("Password recovery") }}{{ end }} {{ block main() }} {{- step := .Form.Get("step").Value() -}}

{{ yield title() }}

{{- if step == 0 -}}
{{ yield formErrors(form=.Form) }}

{{ gettext("No worries, it happens to anyone.") }}

{{ gettext(` Please provide the email address you used to create your account and we'll send you a message with a link to recover your password. `) }}

{{ yield textField(field=.Form.Get("email"), label=gettext("Email address"), class="max", ) }}

{{ gettext("Cancel and go back to sign in") }}

{{- else if step == 1 -}} {{- yield message(type="success") content -}}

{{ gettext("Almost there!") }}

{{ gettext(` We have sent an email to %s with further instructions. `, html(.Form.Get("email").String()))|unsafe }}

{{- end -}} {{- else if step == 2 -}} {{- if isset(.Error) -}} {{- yield message(type="error") content }}{{ .Error }}{{ end -}} {{- else -}}
{{ yield formErrors(form=.Form) }} {{ yield passwordField(field=.Form.Get("password"), label=gettext("New password"), class="max", help=gettext("must be at least 8 characters long")) }}

{{ gettext("Cancel and go back to sign in") }}

{{- end -}} {{- else if step == 3 -}} {{- yield message(type="success") content -}}

{{ gettext("Your password has been changed.") }}

{{ gettext("Go to the sign in page") }}

{{- end -}} {{- end -}} {{ end }}