auth/web/home.qtpl

81 lines
1.9 KiB
Plaintext
Raw Normal View History

{% import (
"source.toby3d.me/toby3d/auth/internal/domain"
) %}
{% code type HomePage struct {
BaseOf
2022-01-20 19:50:15 +00:00
Client *domain.Client
State string
} %}
{% collapsespace %}
{% func (p *HomePage) Head() %}
2023-01-16 10:19:22 +00:00
{%= 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() %}
2023-01-16 10:19:22 +00:00
<header class="h-app h-x-app">
<img class="u-logo"
src="{%s p.Client.GetLogo().String() %}"
alt="{%s p.Client.GetName() %}"
crossorigin="anonymous"
decoding="async"
height="140"
importance="high"
referrerpolicy="no-referrer-when-downgrade"
width="140">
2023-01-16 10:19:22 +00:00
<h1>
<a class="p-name u-url"
href="{%s p.Client.GetURL().String() %}">
2023-01-16 10:19:22 +00:00
{%s p.Client.GetName() %}
</a>
</h1>
</header>
2023-01-16 10:19:22 +00:00
<main>
<form class=""
method="get"
action="/authorize"
enctype="application/x-www-form-urlencoded"
accept-charset="utf-8"
target="_self">
2023-01-16 10:19:22 +00:00
{% for name, value := range map[string]string{
2022-01-20 19:50:15 +00:00
"client_id": p.Client.ID.String(),
"redirect_uri": p.Client.RedirectURI[0].String(),
"response_type": domain.ResponseTypeCode.String(),
"state": p.State,
} %}
2023-01-16 10:19:22 +00:00
<input type="hidden"
name="{%s name %}"
value="{%s value %}">
{% endfor %}
{% for _, scope := range []domain.Scope{
domain.ScopeEmail,
domain.ScopeProfile,
} %}
2023-01-16 10:19:22 +00:00
<input type="hidden"
name="scope[]"
value="{%s scope.String() %}">
{% endfor %}
2023-01-16 10:19:22 +00:00
<input type="url"
name="me"
placeholder="https://example.com/"
inputmode="url"
autocomplete="url"
required>
2023-01-16 10:19:22 +00:00
<button type="submit">{%= p.T("Sign In") %}</button>
</form>
</main>
{% endfunc %}
{% endcollapsespace %}