Skip to content

Commit f1d69b3

Browse files
committed
refactor(auth-ui): polish device authorization, signup, and SSO screens
- Replace custom lists with datum-ui Badge components for requested scopes in device authorization. - Add a BackLink and refine the description and layout on the signup method page. - Inline the active login name in the SSO linked accounts card description and adjust icon fallbacks.
1 parent a1cd85d commit f1d69b3

4 files changed

Lines changed: 47 additions & 32 deletions

File tree

app/modules/i18n/locales/en.po

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ msgstr "Authorize"
109109
msgid "Authorize device"
110110
msgstr "Authorize device"
111111

112-
#: app/routes/sso/index.tsx:175
112+
#: app/routes/sso/index.tsx:186
113113
msgid "Available accounts to link"
114114
msgstr "Available accounts to link"
115115

@@ -136,7 +136,7 @@ msgid "Change your password"
136136
msgstr "Change your password"
137137

138138
#: app/routes/password/reset.tsx:97
139-
#: app/routes/signup/method.tsx:221
139+
#: app/routes/signup/method.tsx:222
140140
#: app/routes/signup/password.tsx:145
141141
msgid "Check your email"
142142
msgstr "Check your email"
@@ -174,7 +174,7 @@ msgstr "Confirm new password"
174174
msgid "Confirm password"
175175
msgstr "Confirm password"
176176

177-
#: app/routes/sso/index.tsx:130
177+
#: app/routes/sso/index.tsx:137
178178
msgid "Connected accounts"
179179
msgstr "Connected accounts"
180180

@@ -230,7 +230,7 @@ msgstr "Email code"
230230

231231
#: app/routes/login/index.tsx:390
232232
#: app/routes/login/method.tsx:125
233-
#: app/routes/signup/method.tsx:264
233+
#: app/routes/signup/method.tsx:265
234234
msgid "Email me a sign-in link"
235235
msgstr "Email me a sign-in link"
236236

@@ -299,7 +299,7 @@ msgstr "Enter your password"
299299
msgid "Enter your SMS code"
300300
msgstr "Enter your SMS code"
301301

302-
#: app/routes/signup/method.tsx:243
302+
#: app/routes/signup/method.tsx:244
303303
msgid "Finish creating your account"
304304
msgstr "Finish creating your account"
305305

@@ -449,10 +449,6 @@ msgstr "Register passkey"
449449
msgid "Registration is currently unavailable. Please contact your administrator."
450450
msgstr "Registration is currently unavailable. Please contact your administrator."
451451

452-
#: app/routes/device/authorize.tsx:115
453-
msgid "Requested permissions"
454-
msgstr "Requested permissions"
455-
456452
#: app/routes/login/verify/email.tsx:95
457453
#: app/routes/login/verify/sms.tsx:92
458454
#: app/routes/verify/index.tsx:200
@@ -492,7 +488,7 @@ msgstr "Service temporarily unavailable. Please try again."
492488
msgid "Session active"
493489
msgstr "Session active"
494490

495-
#: app/routes/signup/method.tsx:300
491+
#: app/routes/signup/method.tsx:301
496492
#: app/routes/signup/password.tsx:160
497493
msgid "Set a password"
498494
msgstr "Set a password"
@@ -549,7 +545,7 @@ msgstr "Sign in with LDAP"
549545
#: app/routes/logout/index.tsx:48
550546
#: app/routes/logout/index.tsx:54
551547
#: app/routes/signed-in.tsx:99
552-
#: app/routes/sso/index.tsx:201
548+
#: app/routes/sso/index.tsx:212
553549
msgid "Sign out"
554550
msgstr "Sign out"
555551

@@ -651,11 +647,11 @@ msgstr "Too many attempts. Please wait a moment and try again."
651647
msgid "Two-factor verification"
652648
msgstr "Two-factor verification"
653649

654-
#: app/routes/sso/index.tsx:161
650+
#: app/routes/sso/index.tsx:172
655651
msgid "Unlink"
656652
msgstr "Unlink"
657653

658-
#: app/routes/signup/method.tsx:282
654+
#: app/routes/signup/method.tsx:283
659655
msgid "Use a passkey"
660656
msgstr "Use a passkey"
661657

@@ -736,7 +732,7 @@ msgstr "We've sent a password reset link to <0>{0}</0>"
736732

737733
#. placeholder {0}: (actionData as { email: string }).email
738734
#. placeholder {0}: actionData.email
739-
#: app/routes/signup/method.tsx:223
735+
#: app/routes/signup/method.tsx:224
740736
#: app/routes/signup/password.tsx:147
741737
msgid "We've sent a verification link to <0>{0}</0>"
742738
msgstr "We've sent a verification link to <0>{0}</0>"
@@ -754,9 +750,10 @@ msgstr "You are signed in"
754750
msgid "You are signed in as <0>{loginName}</0>"
755751
msgstr "You are signed in as <0>{loginName}</0>"
756752

757-
#: app/routes/sso/index.tsx:122
758-
msgid "You can link multiple accounts to your Datum account."
759-
msgstr "You can link multiple accounts to your Datum account."
753+
#. placeholder {0}: loginName && ( <> Logged in as <span className="font-medium">{loginName}</span>. </> )
754+
#: app/routes/sso/index.tsx:123
755+
msgid "You can link multiple accounts to your Datum account. {0}"
756+
msgstr "You can link multiple accounts to your Datum account. {0}"
760757

761758
#: app/routes/signed-in.tsx:72
762759
msgid "You can now close this window and return to the device where you started."
@@ -782,6 +779,10 @@ msgstr "You must be signed in to link an external account."
782779
msgid "You'll need to set a password to complete your signup."
783780
msgstr "You'll need to set a password to complete your signup."
784781

782+
#: app/routes/signup/method.tsx:246
783+
msgid "You're almost done! <0>{loginName}</0>"
784+
msgstr "You're almost done! <0>{loginName}</0>"
785+
785786
#: app/routes/logout/success.tsx:12
786787
msgid "You've been signed out"
787788
msgstr "You've been signed out"

app/routes/device/authorize.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import {
1010
import { paths } from '@/routes/paths';
1111
import { providerForRequest } from '@/server/auth-context.server';
1212
import { getCsrfToken, assertCsrf } from '@/server/csrf';
13+
import { Badge } from '@datum-cloud/datum-ui/badge';
1314
import { Button, LinkButton } from '@datum-cloud/datum-ui/button';
14-
import { Trans, useLingui } from '@lingui/react/macro';
15+
import { Trans } from '@lingui/react/macro';
1516
import {
1617
data,
1718
redirect,
@@ -61,7 +62,6 @@ export default function DeviceAuthorize() {
6162
const loaderData = useLoaderData<typeof loader>();
6263
const actionData = useActionData<typeof action>();
6364
const navigation = useNavigation();
64-
const { t } = useLingui();
6565
const isSubmitting = navigation.state === 'submitting';
6666

6767
// Inline-only error surface for the deny/authorize ACTION error: it renders in a
@@ -112,13 +112,13 @@ export default function DeviceAuthorize() {
112112
</p>
113113
)}
114114
{scope.length > 0 && (
115-
<ul aria-label={t`Requested permissions`} className="flex flex-col gap-2">
115+
<div className="flex flex-wrap items-center gap-3">
116116
{scope.map((s) => (
117-
<li key={s} className="rounded-md border px-3 py-2 text-sm break-all">
117+
<Badge type="quaternary" key={s}>
118118
{s}
119-
</li>
119+
</Badge>
120120
))}
121-
</ul>
121+
</div>
122122
)}
123123
<RRForm method="post" className="flex w-full flex-col gap-4">
124124
<input type="hidden" name="csrf" value={csrfToken} />

app/routes/signup/method.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { AuthCard } from '@/components/auth-card/auth-card';
22
import { AuthCeremony } from '@/components/auth-ceremony/auth-ceremony';
33
import { AuthFormFields } from '@/components/auth-form/auth-form-fields';
4+
import { BackLink } from '@/components/back-link/back-link';
45
import { useAuthActionError } from '@/hooks/use-auth-action-error';
56
import { readSessions, serializeSessions } from '@/modules/auth/session/cookie';
67
import { genericCheckYourEmail } from '@/resources/schemas/check-your-email.schema';
@@ -242,12 +243,12 @@ export default function SignupMethod() {
242243
<AuthCeremony
243244
title={<Trans>Finish creating your account</Trans>}
244245
description={
245-
<>
246-
{firstName} {lastName} · {loginName}
247-
</>
246+
<Trans>
247+
You're almost done! <span className="font-medium">{loginName}</span>
248+
</Trans>
248249
}
249250
error={errorMessage}>
250-
<div className="flex flex-col gap-3">
251+
<div className="flex w-full flex-col gap-3">
251252
{/* Email-link (passwordless) — always shown when email entry is allowed */}
252253
{view.showEmailLink ? (
253254
<RRForm method="post">
@@ -302,6 +303,8 @@ export default function SignupMethod() {
302303
</RRForm>
303304
) : null}
304305
</div>
306+
307+
<BackLink />
305308
</AuthCeremony>
306309
);
307310
}

app/routes/sso/index.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,17 @@ export default function SsoPage() {
119119
return (
120120
<AuthCard
121121
title={<Trans>Linked accounts</Trans>}
122-
description={<Trans>You can link multiple accounts to your Datum account.</Trans>}>
122+
description={
123+
<Trans>
124+
You can link multiple accounts to your Datum account.{' '}
125+
{loginName && (
126+
<>
127+
Logged in as <span className="font-medium">{loginName}</span>.
128+
</>
129+
)}
130+
</Trans>
131+
}>
123132
<div className="flex w-full flex-col gap-4">
124-
{loginName ? <p className="text-foreground text-center text-sm">{loginName}</p> : null}
125-
126133
{/* Linked IdPs */}
127134
{linked.length > 0 ? (
128135
<section className="flex flex-col gap-3">
@@ -137,8 +144,12 @@ export default function SsoPage() {
137144
{/* 755-M6: provider icon + name badge (joined from the active-IdP list).
138145
Falls back to the bare IdP user name / id when the provider is no longer
139146
active. Icon is non-interactive — no nested-interactive a11y violation. */}
140-
<span className="flex min-w-0 items-center gap-2">
141-
<IdpIcon type={link.type} name={link.name} logoUrl={link.logoUrl} />
147+
<span className="flex min-w-0 items-center gap-3">
148+
<IdpIcon
149+
type={link.type}
150+
name={link.name || link.idpUserName || link.idpId}
151+
logoUrl={link.logoUrl}
152+
/>
142153
<span className="flex min-w-0 flex-col">
143154
<span className="text-foreground truncate text-sm">
144155
{link.name || link.idpUserName || link.idpId}

0 commit comments

Comments
 (0)