Files
letro-authentication-service/templates/pages/upstream_oauth2/do_register.html

140 lines
5.3 KiB
HTML

{#
Copyright 2022 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#}
{% extends "base.html" %}
{% block content %}
{% if force_localpart %}
<header class="page-heading">
<div class="icon">
{{ icon.download() }}
</div>
<div class="header">
<h1 class="title">
{{ _("mas.upstream_oauth2.register.import_data.heading") }}
</h1>
<p class="text">
{{ _("mas.upstream_oauth2.register.import_data.description", server_name=branding.server_name) }}
</p>
</div>
</header>
{% else %}
<header class="page-heading">
<div class="icon">
{{ icon.mention() }}
</div>
<div class="header">
<h1 class="title">
{{ _("mas.upstream_oauth2.register.choose_username.heading") }}
</h1>
<p class="text">
{{ _("mas.upstream_oauth2.register.choose_username.description") }}
</p>
</div>
</header>
{% endif %}
<form method="POST" class="cpd-form-root">
<input type="hidden" name="csrf" value="{{ csrf_token }}" />
<input type="hidden" name="action" value="register" />
{% if force_localpart %}
{% call(f) field.field(label=_("common.mxid"), name="mxid") %}
<input {{ field.attributes(f) }} class="cpd-text-control" type="text" value="@{{ suggested_localpart }}:{{ branding.server_name }}" readonly aria-describedby="{{ f.id }}-help" />
<div class="cpd-form-message cpd-form-help-message" id="{{ f.id }}-help">
{{ _("mas.upstream_oauth2.register.enforced_by_policy") }}
</div>
{% endcall %}
{% else %}
{% call(f) field.field(label=_("common.username"), name="username") %}
<input {{ field.attributes(f) }} class="cpd-text-control" type="text" autocomplete="username" autocorrect="off" autocapitalize="none" value="{{ suggested_localpart or '' }}" aria-describedby="{{ f.id }}-help" />
<div class="cpd-form-message cpd-form-help-message" id="{{ f.id }}-help">
@{{ suggested_localpart or (_("common.username") | lower) }}:{{ branding.server_name }}
</div>
{% endcall %}
{% endif %}
{% if suggested_email %}
<div class="flex gap-6 items-center">
{% call(f) field.field(label=_("common.email_address"), name="email", class="flex-1") %}
<input {{ field.attributes(f) }} class="cpd-text-control" type="email" value="{{ suggested_email }}" readonly aria-describedby="{{ f.id }}-help" />
<div class="cpd-form-message cpd-form-help-message" id="{{ f.id }}-help">
{{ _("mas.upstream_oauth2.register.imported_from_upstream") }}
</div>
{% endcall %}
{% if not force_email %}
<div class="cpd-form-inline-field">
<div class="cpd-form-inline-field-control">
<div class="cpd-checkbox-container">
<input class="cpd-checkbox-input" type="checkbox" name="import_email" id="import_email" checked="checked" />
<div class="cpd-checkbox-ui">
{{ icon.check() }}
</div>
</div>
</div>
<label class="cpd-form-label" for="import_email">
{{- _("mas.upstream_oauth2.register.use") -}}
</label>
</div>
{% endif %}
</div>
{% endif %}
{% if suggested_display_name %}
<div class="flex gap-6 items-center">
{% call(f) field.field(label=_("common.display_name"), name="display_name", class="flex-1") %}
<input {{ field.attributes(f) }} class="cpd-text-control" type="text" value="{{ suggested_display_name }}" readonly />
<div class="cpd-form-message cpd-form-help-message">
{{ _("mas.upstream_oauth2.register.imported_from_upstream") }}
</div>
{% endcall %}
{% if not force_display_name %}
<div class="cpd-form-inline-field">
<div class="cpd-form-inline-field-control">
<div class="cpd-checkbox-container">
<input class="cpd-checkbox-input" type="checkbox" name="import_display_name" id="import_display_name" checked="checked" />
<div class="cpd-checkbox-ui">
{{ icon.check() }}
</div>
</div>
</div>
<div class="cpd-form-inline-field-body">
<label class="cpd-form-label" for="import_display_name">
{{- _("mas.upstream_oauth2.register.use") -}}
</label>
</div>
</div>
{% endif %}
</div>
{% endif %}
{{ button.button(text=_("action.create_account")) }}
</form>
{# Leave this for now as we don't have that fully designed yet
{{ field.separator() }}
{{ button.link_outline(text=_("mas.upstream_oauth2.register.link_existing"), href=login_link) }}
#}
{% endblock content %}