{* SPDX-FileCopyrightText: © 2025 Olivier Meunier SPDX-License-Identifier: AGPL-3.0-only *} {{ extends "../base" }} {{ import "/_libs/forms" }} {{ block title() }}{{ gettext("Authorization required") }}{{ end }} {{- block backBtn() -}}

{{ gettext("Go back to Readeck") }}

{{- end -}} {{ block main() }} {{- if isset(.Error) -}} {{- yield message(type="error") content -}}

Error

{{ .Error }}

{{- end -}} {{- yield backBtn() -}} {{- else if .Step == "code" -}} {* Device Code form *}

{{ gettext("Connect a device") }}

{{ yield textField(field=.Form.Get("user_code"), label=gettext("Enter the code displayed on your device"), class="max", inputClass="form-input w-full text-center text-lg font-bold", inputAttrs=attrList("autocapitalize", "off"), ) }}
{{- else if .Step == "pending" -}} {* Authorization form *} {{ include("./form") }} {{- else if .Step == "denied" -}} {* Authorization was denied *}

{{ gettext("Connect a device") }}

{{ gettext("Authorization request was denied.") }} {{ gettext(" You can now close this page.") }}

{{- yield backBtn() -}} {{- else if .Step == "granted" -}} {* Authorization was granted *}

{{ gettext("Connect a device") }}

{{- if .Request.TokenID < 0 -}}

{{ gettext("Authorization granted. Connecting device...") }}

{{ yield spinner() }}

{{ gettext( `Reload this page if it doesn't refresh after a few seconds.`, urlFor(``), )|raw }} {{- else -}}

{{ gettext("Device is connected!") }} {{ gettext("You can now close this page.") }}

{{- yield backBtn() -}} {{- end -}} {{- end -}} {{ end }}