Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Commit 86d53c9

Browse files
authored
Standardise consent screens (#1674)
1 parent 17f8dc4 commit 86d53c9

File tree

4 files changed

+57
-26
lines changed

4 files changed

+57
-26
lines changed

templates/base.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
{% import "components/logout.html" as logout %}
2121
{% import "components/navbar.html" as navbar %}
2222
{% import "components/errors.html" as errors %}
23+
{% import "components/scope.html" as scope %}
2324

2425
<!DOCTYPE html>
2526
<html>

templates/components/scope.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{#
2+
Copyright 2023 The Matrix.org Foundation C.I.C.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
#}
16+
17+
{% macro list(scopes) %}
18+
<ul class="list-disc">
19+
{% for scope in scopes | split(pat=" ") %}
20+
{% if scope == "openid" %}
21+
<li>See your profile info and contact details</li>
22+
{% elif scope == "urn:mas:graphql:*" %}
23+
<li>Edit your profile and contact details</li>
24+
<li>Manage your devices and sessions</li>
25+
{% elif scope == "urn:matrix:org.matrix.msc2967.client:api:*" %}
26+
<li>View your existing messages and data</li>
27+
<li>Send new messages on your behalf</li>
28+
{% elif scope == "urn:synapse:admin:*" %}
29+
<li>Administer the Synapse homeserver</li>
30+
{% elif scope == "urn:mas:graphql:admin" %}
31+
<li>Administer any user on the MAS authentication server</li>
32+
{% elif scope is matching("^urn:matrix:org.matrix.msc2967.client:device:") %}
33+
{# <li>{{ scope }}</li> #}
34+
{% else %}
35+
<li>{{ scope }}</li>
36+
{% endif %}
37+
{% endfor %}
38+
</ul>
39+
{% endmacro %}

templates/pages/consent.html

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,38 +27,18 @@
2727
<img class="w-16 h-16" src="{{ client.logo_uri }}" />
2828
{% endif %}
2929
</div>
30-
<h1 class="text-lg text-center font-medium"><a target="_blank" href="{{ client.client_uri }}" class="text-accent">{{ client.client_name | default(value=client.client_id) }}</a></h1>
31-
<h1>at {{ grant.redirect_uri }}</h1>
32-
<h1>wants to access your Matrix account</h1>
30+
<h1 class="text-center font-medium"><a target="_blank" href="{{ client.client_uri }}" class="text-accent">{{ client.client_name | default(value=client.client_id) }}</a></h1>
31+
<h1>at {{ grant.redirect_uri | simplify_url }}</h1>
32+
<h1>wants to access your account</h1>
3333
</div>
3434
<div class="flex items-center m-2">
3535
<div class="px-4 flex-1">
3636
<p>This will allow <a target="_blank" href="{{ client.client_uri }}" class="text-accent">{{ client.client_name | default(value=client.client_id) }}</a> to:</p>
3737

3838
<p class="my-2">
39-
<ul class="list-disc">
40-
{% for scope in grant.scope | split(pat=" ") %}
41-
{% if scope == "openid" %}
42-
<li>See your profile info and contact details</li>
43-
{% elif scope == "urn:mas:graphql:*" %}
44-
<li>Edit your profile and contact details</li>
45-
<li>Manage your devices and sessions</li>
46-
{% elif scope == "urn:matrix:org.matrix.msc2967.client:api:*" %}
47-
<li>View your existing messages and data</li>
48-
<li>Send new messages on your behalf</li>
49-
{% elif scope == "urn:synapse:admin:*" %}
50-
<li>Administer the Synapse homeserver</li>
51-
{% elif scope == "urn:mas:graphql:admin" %}
52-
<li>Administer any user on the MAS authentication server</li>
53-
{% elif scope is matching("^urn:matrix:org.matrix.msc2967.client:device:") %}
54-
{# <li>{{ scope }}</li> #}
55-
{% else %}
56-
<li>{{ scope }}</li>
57-
{% endif %}
58-
{% endfor %}
59-
</ul>
39+
{{ scope::list(scopes=grant.scope) }}
6040
</p>
61-
<p class="font-bold my-2">Make sure that you trust {{ client.client_name }}</p>
41+
<p class="font-bold my-2">Make sure that you trust {{ client.client_name | default(value=client.client_id) }}.</p>
6242
<p>
6343
You may be sharing sensitive information with this site or app.
6444
{% if client.policy_uri or client.tos_uri %}

templates/pages/sso.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,18 @@
2323
<div class="rounded-lg bg-grey-25 dark:bg-grey-450 p-2 flex flex-col">
2424
<div class="text-center">
2525
<h1 class="text-lg text-center font-medium">{{ login.redirect_uri | simplify_url }}</h1>
26-
<h1>wants to access your Matrix account</h1>
26+
<h1>wants to access your account</h1>
27+
</div>
28+
<div class="flex items-center m-2">
29+
<div class="px-4 flex-1">
30+
<p>This will allow it to:</p>
31+
32+
<p class="my-2">
33+
{{ scope::list(scopes="openid urn:matrix:org.matrix.msc2967.client:api:*") }}
34+
</p>
35+
36+
<p class="font-bold my-2">Make sure that you trust it.</p>
37+
</div>
2738
</div>
2839
</div>
2940

0 commit comments

Comments
 (0)