auth/web/home.qtpl

75 lines
1.8 KiB
Plaintext
Raw Permalink 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 %}
2023-08-06 00:42:38 +00:00
{% func (p *HomePage) head() %}
{%= p.BaseOf.head() %}
2023-01-16 10:19:22 +00:00
{% for i := range p.Client.RedirectURI %}
<link rel="redirect_uri"
href="{%s p.Client.RedirectURI[i].String() %}">
{% endfor %}
{% endfunc %}
2023-08-06 00:42:38 +00:00
{% func (p *HomePage) body() %}
2023-01-16 10:19:22 +00:00
<header class="h-app h-x-app">
2023-08-07 03:10:00 +00:00
{% if p.Client.Logo != nil %}
2023-01-16 10:19:22 +00:00
<img class="u-logo"
2023-08-07 03:10:00 +00:00
src="{%s p.Client.Logo.String() %}"
alt="{%s p.Client.Name %}"
2023-01-16 10:19:22 +00:00
crossorigin="anonymous"
decoding="async"
height="140"
importance="high"
referrerpolicy="no-referrer-when-downgrade"
width="140">
2023-08-07 03:10:00 +00:00
{% endif %}
2023-01-16 10:19:22 +00:00
<h1>
<a class="p-name u-url"
2023-08-07 03:10:00 +00:00
href="{%s p.Client.URL.String() %}">
2023-08-07 03:10:00 +00:00
{%s p.Client.Name %}
2023-01-16 10:19:22 +00:00
</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(),
2023-08-06 00:42:38 +00:00
"scope": domain.Scopes{domain.ScopeEmail, domain.ScopeProfile}.String(),
2022-01-20 19:50:15 +00:00
"state": p.State,
} %}
2023-01-16 10:19:22 +00:00
<input type="hidden"
name="{%s name %}"
value="{%s value %}">
{% endfor %}
<input type="url"
name="me"
placeholder="https://example.com/"
inputmode="url"
autocomplete="url"
required>
2023-08-06 00:42:38 +00:00
<button type="submit">{%= p.t("Sign In") %}</button>
2023-01-16 10:19:22 +00:00
</form>
</main>
{% endfunc %}
{% endcollapsespace %}