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

Commit d39a1d2

Browse files
committed
Show the device better in the device consent page
1 parent 3df600b commit d39a1d2

File tree

4 files changed

+87
-19
lines changed

4 files changed

+87
-19
lines changed

frontend/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"rimraf": "^5.0.5",
7777
"storybook": "^7.6.0",
7878
"storybook-react-i18next": "^2.0.9",
79-
"tailwindcss": "^3.3.5",
79+
"tailwindcss": "^3.4.1",
8080
"typescript": "5.3.2",
8181
"vite": "^4.5.0",
8282
"vite-plugin-compression": "^0.5.1",

frontend/src/templates.css

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,59 @@
6161
color: var(--cpd-color-text-secondary);
6262
}
6363

64+
.consent-device-card {
65+
display: flex;
66+
gap: var(--cpd-space-4x);
67+
flex-direction: column;
68+
text-align: start;
69+
margin: var(--cpd-space-2x) 0;
70+
71+
border-radius: var(--cpd-space-4x);
72+
background-color: var(--cpd-color-bg-canvas-default);
73+
border: 1px solid var(--cpd-color-border-interactive-secondary);
74+
box-shadow: 0px 1.2px 2.4px 0px rgba(0, 0, 0, 0.15);
75+
padding: var(--cpd-space-6x);
76+
77+
& .device {
78+
display: flex;
79+
gap: var(--cpd-space-4x);
80+
align-items: center;
81+
82+
& svg {
83+
aspect-ratio: 1;
84+
border-radius: var(--cpd-space-2x);
85+
background-color: var(--cpd-color-bg-subtle-secondary);
86+
color: var(--cpd-color-icon-secondary);
87+
padding: var(--cpd-space-2x);
88+
height: var(--cpd-space-10x);
89+
width: var(--cpd-space-10x);
90+
}
91+
92+
& .name {
93+
font: var(--cpd-font-body-md-semibold);
94+
letter-spacing: var(--cpd-font-letter-spacing-body-md);
95+
color: var(--cpd-color-text-primary);
96+
}
97+
}
98+
99+
& .meta {
100+
display: flex;
101+
gap: var(--cpd-space-10x);
102+
103+
& .key {
104+
font: var(--cpd-font-body-sm-regular);
105+
letter-spacing: var(--cpd-font-letter-spacing-body-sm);
106+
color: var(--cpd-color-text-secondary);
107+
}
108+
109+
& .value {
110+
font: var(--cpd-font-body-md-regular);
111+
letter-spacing: var(--cpd-font-letter-spacing-body-md);
112+
color: var(--cpd-color-text-primary);
113+
}
114+
}
115+
}
116+
64117
.consent-client-icon {
65118
display: block;
66119
height: var(--cpd-space-16x);
@@ -89,12 +142,13 @@
89142

90143
.consent-scope-list {
91144
--border-radius: var(--cpd-space-4x);
145+
92146
& ul {
93147
display: flex;
94148
flex-direction: column;
95149
gap: var(--cpd-space-1x);
96150

97-
& > li {
151+
&>li {
98152
font: var(--cpd-font-body-md-regular);
99153
letter-spacing: var(--cpd-font-letter-spacing-body-md);
100154
color: var(--cpd-color-text-primary);
@@ -115,11 +169,11 @@
115169
border-bottom-right-radius: var(--border-radius);
116170
}
117171

118-
& > p {
172+
&>p {
119173
flex: 1;
120174
}
121175

122-
& > svg {
176+
&>svg {
123177
display: block;
124178
height: var(--cpd-space-6x);
125179
width: var(--cpd-space-6x);
@@ -208,6 +262,7 @@
208262
font: var(--cpd-font-body-lg-regular);
209263
letter-spacing: var(--cpd-font-letter-spacing-body-lg);
210264
color: var(--cpd-color-text-secondary);
265+
text-wrap: balance;
211266

212267
& em {
213268
font-style: normal;

templates/pages/device_consent.html

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,38 @@
3131

3232
<div class="header">
3333
<h1 class="title">Allow access to your account?</h1>
34+
35+
<div class="consent-device-card">
36+
<div class="device">
37+
{{ icon.web_browser() }}
38+
{# TODO: Infer from the user agent #}
39+
<div class="name">Device</div>
40+
</div>
41+
<div class="meta">
42+
{# TODO: add the IP address #}
43+
<div>
44+
<div class="key">Access requested</div>
45+
<div class="value">{{ _.relative_date(grant.created_at) | title }} {{ _.short_time(grant.created_at) }}</div>
46+
</div>
47+
<div>
48+
<div class="key">Code</div>
49+
<div class="value">{{ grant.user_code }}</div>
50+
</div>
51+
</div>
52+
</div>
53+
3454
<p class="text">
35-
{% if client.client_uri %}
36-
<a target="_blank" href="{{ client.client_uri }}">{{ client_name }}</a>
37-
{% else %}
38-
{{ client_name }}
39-
{% endif %}
40-
wants to access your account. This will allow <span class="whitespace-nowrap">{{ client_name }}</span> to:</p>
55+
Another device wants to access your account.
56+
This will allow <span class="whitespace-nowrap">{{ client_name }}</span> to:
57+
</p>
4158
</div>
4259
</header>
4360

4461
<section class="consent-scope-list">
4562
{{ scope.list(scopes=grant.scope) }}
4663
</section>
4764

48-
<section class="text-center cpd-text-secondary cpd-text-body-md-regular">
65+
<section class="text-center text-balance cpd-text-secondary cpd-text-body-md-regular">
4966
<span class="font-semibold cpd-text-primary">Make sure that you trust <span class="whitespace-nowrap">{{ client_name }}</span>.</span>
5067
You may be sharing sensitive information with this site or app.
5168
{% if client.policy_uri or client.tos_uri %}
@@ -62,10 +79,6 @@ <h1 class="title">Allow access to your account?</h1>
6279
{% endif %}
6380
</section>
6481

65-
<section class="cpd-text-primary cpd-text-body-md-regular">
66-
This request was made on another device, which should display the following code: {{ grant.user_code }}.
67-
</section>
68-
6982
<section class="flex flex-col gap-6">
7083
<form method="POST" class="cpd-form-root">
7184
<input type="hidden" name="csrf" value="{{ csrf_token }}" />

0 commit comments

Comments
 (0)