{* SPDX-FileCopyrightText: © 2021 Olivier Meunier SPDX-License-Identifier: AGPL-3.0-only *} {{ extends "./base" }} {{ import "/_libs/forms" }} {{ block title() }}{{ gettext("API Token") }}{{ end }} {{ block mainContent() }}

{{ yield title() }}

{{ if .Token.IsDeleted -}}
{{- yield message() content -}} {{ gettext("Token will be removed in a few seconds.") }}  {{- end -}}
{{- end }}

{{ gettext("Properties") }}

{{ yield formErrors(form=.Form) }}
{{ .Token.UID }}
{{ .Token.LastUsed ? date(.Token.LastUsed, "%c") : gettext("never used") }}
{{ yield textField( field=.Form.Get("application"), required=true, label=gettext("Name"), class="field-h" ) }} {{ yield checkboxField( field=.Form.Get("is_enabled"), label=gettext("Enabled"), class="field-h", ) }} {{ yield dateField( field=.Form.Get("expires"), label=gettext("Expires on"), class="field-h", ) }}

Roles

{{ gettext(` You can limit the permissions granted to this token by choosing one or more group of permissions below.
Leave all the choices blank to grant all your permissions to this token. `)|raw }}

{{ yield multiSelectField( field=.Form.Get("roles"), label=gettext("Roles"), class="field-h", ) }}

{{ if !.Token.IsDeleted -}}

{{- end }}

{{ gettext("Authentication") }}

{{- yield icon(name="o-download") }} {{ gettext("Download as a text file") -}}

{{ gettext("How to use it") }}

{{ gettext("As a Bearer Token") }}

{{ gettext("You can use this token by passing it as an Authorization: Bearer HTTP header.")|raw }}

{{ gettext("As a password") }}

{{ gettext("Alternatively, you can use this token as a password for HTTP Basic Authentication.") }}

{{ gettext( `For example, if an application only accepts a username and password, you can provide this token as a password. The username is ignored and can be anything, including an empty value.` ) }}

{{ end }}