auth/web/home.qtpl

75 lines
1.8 KiB
Plaintext

{% import (
"source.toby3d.me/toby3d/auth/internal/domain"
) %}
{% code type HomePage struct {
BaseOf
Client *domain.Client
State string
} %}
{% collapsespace %}
{% func (p *HomePage) head() %}
{%= p.BaseOf.head() %}
{% for i := range p.Client.RedirectURI %}
<link rel="redirect_uri"
href="{%s p.Client.RedirectURI[i].String() %}">
{% endfor %}
{% endfunc %}
{% func (p *HomePage) body() %}
<header class="h-app h-x-app">
{% if p.Client.Logo != nil %}
<img class="u-logo"
src="{%s p.Client.Logo.String() %}"
alt="{%s p.Client.Name %}"
crossorigin="anonymous"
decoding="async"
height="140"
importance="high"
referrerpolicy="no-referrer-when-downgrade"
width="140">
{% endif %}
<h1>
<a class="p-name u-url"
href="{%s p.Client.URL.String() %}">
{%s p.Client.Name %}
</a>
</h1>
</header>
<main>
<form class=""
method="get"
action="/authorize"
enctype="application/x-www-form-urlencoded"
accept-charset="utf-8"
target="_self">
{% for name, value := range map[string]string{
"client_id": p.Client.ID.String(),
"redirect_uri": p.Client.RedirectURI[0].String(),
"response_type": domain.ResponseTypeCode.String(),
"scope": domain.Scopes{domain.ScopeEmail, domain.ScopeProfile}.String(),
"state": p.State,
} %}
<input type="hidden"
name="{%s name %}"
value="{%s value %}">
{% endfor %}
<input type="url"
name="me"
placeholder="https://example.com/"
inputmode="url"
autocomplete="url"
required>
<button type="submit">{%= p.t("Sign In") %}</button>
</form>
</main>
{% endfunc %}
{% endcollapsespace %}