Skip to content

Commit 1c692ba

Browse files
refactor(mosaic): show a sign-in lockout as the identifier step's error banner
1 parent 7dfe799 commit 1c692ba

8 files changed

Lines changed: 19 additions & 28 deletions

File tree

‎packages/mosaic/src/features/sign-in/__tests__/sign-in.utils.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ describe('stepKey', () => {
2121
'code:reset-password',
2222
],
2323
[{ kind: 'notice', purpose: 'forgot-password', identifier: 'jane@acme.com' }, 'notice:forgot-password'],
24-
[{ kind: 'notice', purpose: 'locked' }, 'notice:locked'],
2524
[{ kind: 'notice', purpose: 'action-blocked' }, 'notice:action-blocked'],
2625
[{ kind: 'notice', purpose: 'email-link', identifier: 'jane@acme.com' }, 'notice:email-link'],
2726
[{ kind: 'new-password', reason: 'forgot' }, 'new-password:forgot'],

‎packages/mosaic/src/features/sign-in/sign-in.messages.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ export const signInMessages = {
2525
pending: 'Sending code',
2626
back: 'Back to sign in',
2727
},
28-
locked: {
29-
title: 'Account locked',
30-
description:
31-
'Your account is locked after too many failed sign-in attempts. Try again later, or email support for help.',
32-
},
3328
noAvailableMethods: {
3429
title: 'Cannot sign in',
3530
description: 'Cannot proceed with sign in. There’s no available authentication factor.',

‎packages/mosaic/src/features/sign-in/sign-in.types.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export type SignInStep =
2828
| { kind: 'choice'; purpose: 'methods' | 'reset-methods'; options: readonly SignInFactor[] }
2929
| { kind: 'notice'; purpose: 'help' }
3030
| { kind: 'notice'; purpose: 'forgot-password'; identifier: string }
31-
| { kind: 'notice'; purpose: 'locked' | 'no-methods' | 'password-compromised' }
31+
| { kind: 'notice'; purpose: 'no-methods' | 'password-compromised' }
3232
| { kind: 'notice'; purpose: 'action-blocked'; details?: SignInActionBlockedDetails }
3333
| { kind: 'notice'; purpose: 'email-link'; identifier: string }
3434
| { kind: 'new-password'; reason: 'forgot' }

‎packages/mosaic/src/features/sign-in/sign-in.view.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ export function SignInView({
257257
ids={[
258258
'notice:help',
259259
'notice:forgot-password',
260-
'notice:locked',
261260
'notice:no-methods',
262261
'notice:action-blocked',
263262
'notice:password-compromised',

‎packages/mosaic/src/features/sign-in/steps/notice-step.tsx‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ export function NoticeStep({
5555
onBack={onBack}
5656
/>
5757
);
58-
case 'locked':
59-
return (
60-
<VerificationHelp
61-
messages={{ ...m.locked, ...help, backButton: m.forgotPassword.back }}
62-
onEmailSupport={onEmailSupport}
63-
onBack={onBack}
64-
/>
65-
);
6658
case 'no-methods':
6759
return (
6860
<VerificationHelp

‎packages/swingset/src/lib/registry.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ import {
358358
IdentifierBannerError as SignInIdentifierBannerError,
359359
IdentifierDefault as SignInIdentifierDefault,
360360
IdentifierError as SignInIdentifierError,
361+
IdentifierLocked as SignInIdentifierLocked,
361362
IdentifierManyProviders as SignInIdentifierManyProviders,
362363
IdentifierProviderPending as SignInIdentifierProviderPending,
363364
IdentifierSignInOnly as SignInIdentifierSignInOnly,
@@ -368,7 +369,6 @@ import {
368369
NoticeActionBlocked as SignInNoticeActionBlocked,
369370
NoticeEmailLinkSent as SignInNoticeEmailLinkSent,
370371
NoticeHelp as SignInNoticeHelp,
371-
NoticeLocked as SignInNoticeLocked,
372372
NoticeNoMethods as SignInNoticeNoMethods,
373373
NoticePasswordCompromised as SignInNoticePasswordCompromised,
374374
NoticePasswordCompromisedPending as SignInNoticePasswordCompromisedPending,
@@ -1283,6 +1283,7 @@ const signInModule: StoryModule = {
12831283
IdentifierProviderPending: SignInIdentifierProviderPending,
12841284
IdentifierError: SignInIdentifierError,
12851285
IdentifierBannerError: SignInIdentifierBannerError,
1286+
IdentifierLocked: SignInIdentifierLocked,
12861287
CredentialPassword: SignInCredentialPassword,
12871288
CredentialPasswordPending: SignInCredentialPasswordPending,
12881289
CredentialPasswordError: SignInCredentialPasswordError,
@@ -1298,7 +1299,6 @@ const signInModule: StoryModule = {
12981299
NoticeHelp: SignInNoticeHelp,
12991300
NoticeForgotPassword: SignInNoticeForgotPassword,
13001301
NoticeForgotPasswordPending: SignInNoticeForgotPasswordPending,
1301-
NoticeLocked: SignInNoticeLocked,
13021302
NoticeNoMethods: SignInNoticeNoMethods,
13031303
NoticeActionBlocked: SignInNoticeActionBlocked,
13041304
NoticePasswordCompromised: SignInNoticePasswordCompromised,

‎packages/swingset/src/stories/sign-in.mdx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as Stories from './sign-in.stories';
22

33
# SignIn
44

5-
The example pauses briefly in each pending state. An email containing `new` takes the sign-up path. Enter `error` in the password or backup code field, or `000000` for a code, to render an attempt error under the field. Enter `locked` as the password to render one in the banner.
5+
The example pauses briefly in each pending state. An email containing `new` takes the sign-up path. Enter `error` in the password or backup code field, or `000000` for a code, to render an attempt error under the field. Enter `locked` as the password to return to the start with the lockout in the banner.
66

77
## Example
88

@@ -76,6 +76,10 @@ Each section is one component in `features/sign-in/steps/`, and each example und
7676

7777
<Story name='IdentifierBannerError' storyModule={Stories} />
7878

79+
#### Locked
80+
81+
<Story name='IdentifierLocked' storyModule={Stories} />
82+
7983
#### Phone
8084

8185
<Story name='IdentifierPhone' storyModule={Stories} />
@@ -228,10 +232,6 @@ Each section is one component in `features/sign-in/steps/`, and each example und
228232

229233
<Story name='NoticeForgotPasswordPending' storyModule={Stories} />
230234

231-
#### Account locked
232-
233-
<Story name='NoticeLocked' storyModule={Stories} />
234-
235235
#### No available methods
236236

237237
<Story name='NoticeNoMethods' storyModule={Stories} />

‎packages/swingset/src/stories/sign-in.stories.tsx‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ function WorkingExample({ onComplete }: { onComplete: (outcome: Outcome) => void
184184
return;
185185
}
186186
if (values.password.toLowerCase() === 'locked') {
187-
setGlobalErrorMessage('Too many failed attempts. Try again later, or use another method.');
187+
navigate({ kind: 'identifier' }, -1);
188+
setGlobalErrorMessage('Your account is locked. You will be able to try again in 30 minutes.');
188189
return;
189190
}
190191
startSecondFactor();
@@ -554,6 +555,15 @@ export function IdentifierError() {
554555
);
555556
}
556557

558+
export function IdentifierLocked() {
559+
return (
560+
<StepPanel
561+
step={{ kind: 'identifier' }}
562+
globalErrorMessage='Your account is locked. You will be able to try again in 30 minutes. For more information, please contact support.'
563+
/>
564+
);
565+
}
566+
557567
export function IdentifierBannerError() {
558568
return (
559569
<StepPanel
@@ -638,10 +648,6 @@ export function NoticeForgotPasswordPending() {
638648
);
639649
}
640650

641-
export function NoticeLocked() {
642-
return <StepPanel step={{ kind: 'notice', purpose: 'locked' }} />;
643-
}
644-
645651
export function NoticeNoMethods() {
646652
return <StepPanel step={{ kind: 'notice', purpose: 'no-methods' }} />;
647653
}

0 commit comments

Comments
 (0)