Files
matrix-authentication-service/templates/pages/device_consent.html
T
Quentin Gliech 1b4898aa3a Make the consent screens (almost completely) translatable
One exception is the wording for the privacy policy/TOS, because it's
annoying to do with the conditionals.
2024-05-10 14:49:54 +02:00

169 lines
6.5 KiB
HTML

{#
Copyright 2023 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 %}
{% set client_name = client.client_name or client.client_id %}
{% if grant.state == "pending" %}
<header class="page-heading">
{% if client.logo_uri %}
<img class="consent-client-icon image" referrerpolicy="no-referrer" src="{{ client.logo_uri }}" />
{% else %}
<div class="consent-client-icon generic">
{{ icon.web_browser() }}
</div>
{% endif %}
<div class="header">
<h1 class="title">{{ _("mas.consent.heading") }}</h1>
<div class="session-card my-4">
<div class="card-header" {%- if grant.user_agent %} title="{{ grant.user_agent.raw }}"{% endif %}>
<div class="device-type-icon">
{% if grant.user_agent.device_type == "mobile" %}
{{ icon.mobile() }}
{% elif grant.user_agent.device_type == "tablet" %}
{{ icon.web_browser() }}
{% elif grant.user_agent.device_type == "pc" %}
{{ icon.computer() }}
{% else %}
{{ icon.unknown_solid() }}
{% endif %}
</div>
<div class="content auto">
{% if grant.user_agent.model %}
<div>{{ grant.user_agent.model }}</div>
{% endif %}
{% if grant.user_agent.os %}
<div>
{{ grant.user_agent.os }}
{% if grant.user_agent.os_version %}
{{ grant.user_agent.os_version }}
{% endif %}
</div>
{% endif %}
{# If we haven't detected a model, it's probably a browser, so show the name #}
{% if not grant.user_agent.model and grant.user_agent.name %}
<div>
{{ grant.user_agent.name }}
{% if grant.user_agent.version %}
{{ grant.user_agent.version }}
{% endif %}
</div>
{% endif %}
{# If we couldn't detect anything, show a generic "Device" #}
{% if not grant.user_agent.model and not grant.user_agent.name and not grant.user_agent.os %}
<div>{{ _("mas.device_card.generic_device") }}</div>
{% endif %}
</div>
</div>
<div class="metadata">
{% if grant.ip_address %}
<div>
<div class="key">{{ _("mas.device_card.ip_address") }}</div>
<div class="value">{{ grant.ip_address }}</div>
</div>
{% endif %}
<div>
<div class="key">{{ _("mas.device_card.access_requested") }}</div>
<div class="value">{{ _.relative_date(grant.created_at) | title }} {{ _.short_time(grant.created_at) }}</div>
</div>
<div>
<div class="key">{{ _("mas.device_card.device_code") }}</div>
<div class="value">{{ grant.user_code }}</div>
</div>
</div>
</div>
<p class="text [&>span]:whitespace-nowrap">
{{ _("mas.device_consent.another_device_access") }}
{{ _("mas.consent.this_will_allow", client_name=client_name) }}
</p>
</div>
</header>
<section class="consent-scope-list">
{{ scope.list(scopes=grant.scope) }}
</section>
<section class="text-center text-balance cpd-text-secondary cpd-text-body-md-regular [&>span]:whitespace-nowrap">
<strong class="font-semibold cpd-text-primary [&>span]:whitespace-nowrap">{{ _("mas.consent.make_sure_you_trust", client_name=client_name) }}</strong>
{{ _("mas.consent.you_may_be_sharing") }}
{% if client.policy_uri or client.tos_uri %}
Find out how <span>{{ client_name }}</span> will handle your data by reviewing its
{% if client.policy_uri %}
<a target="_blank" href="{{ client.policy_uri }}" class="cpd-link" data-kind="primary">privacy policy</a>{% if not client.tos_uri %}.{% endif %}
{% endif %}
{% if client.policy_uri and client.tos_uri%}
and
{% endif %}
{% if client.tos_uri %}
<a target="_blank" href="{{ client.tos_uri }}" class="cpd-link" data-kind="primary">terms of service</a>.
{% endif %}
{% endif %}
</section>
<section class="flex flex-col gap-6">
<form method="POST" class="cpd-form-root">
<input type="hidden" name="csrf" value="{{ csrf_token }}" />
<button type="submit" name="action" value="consent" class="cpd-button" data-kind="primary" data-size="lg">
{{ _("action.continue") }}
</button>
<button type="submit" name="action" value="reject" class="cpd-button destructive" data-kind="secondary" data-size="lg">
{{ _("action.cancel") }}
</button>
</form>
<div class="flex gap-1 justify-center items-center">
<p class="cpd-text-secondary cpd-text-body-md-regular">
{{ _("mas.not_you", username=current_session.user.username) }}
</p>
{{ logout.button(text=_("action.sign_out"), csrf_token=csrf_token, post_logout_action=action, as_link=true) }}
</div>
</section>
{% elif grant.state == "rejected" %}
<header class="page-heading">
<div class="icon invalid">
{{ icon.block() }}
</div>
<div class="header">
<h1 class="title">{{ _("mas.device_consent.denied.heading") }}</h1>
<p class="text">{{ _("mas.device_consent.denied.description", client_name=client_name) }}</p>
</div>
</header>
{% else %}
<header class="page-heading">
<div class="icon success">
{{ icon.check() }}
</div>
<div class="header">
<h1 class="title">{{ _("mas.device_consent.granted.heading") }}</h1>
<p class="text">{{ _("mas.device_consent.granted.description", client_name=client_name) }}</p>
</div>
</header>
{% endif %}
{% endblock content %}