This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move RecoveryCode component from enterprise (#789)
* Make tweaks based on move * Update e-ref
- Loading branch information
Showing
20 changed files
with
1,323 additions
and
899 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,63 +18,117 @@ import React from 'react'; | |
import { MemoryRouter } from 'react-router-dom'; | ||
import Welcome from './Welcome'; | ||
import { NewCredentials, Props } from './NewCredentials'; | ||
import { mockedProps } from './fixtures/fixtures'; | ||
import CardWelcome from './CardWelcome'; | ||
|
||
export default { title: 'Teleport/Welcome' }; | ||
|
||
export const GetStarted = () => <MockedWelcome url="/web/invite/1234" />; | ||
|
||
export const Continue = () => ( | ||
<MockedWelcome url="/web/invite/1234/continue" Form={Otp} /> | ||
export const WelcomeCustom = () => ( | ||
<CardWelcome | ||
title="Some Title" | ||
subTitle="some small subtitle" | ||
btnText="Button Text" | ||
onClick={() => null} | ||
/> | ||
); | ||
|
||
export const GetStartedReset = () => <MockedWelcome url="/web/reset/1234" />; | ||
|
||
export const ContinueReset = () => ( | ||
<MockedWelcome url="/web/reset/1234/continue" Form={Otp} /> | ||
export const WelcomeInvite = () => ( | ||
<MemoryRouter initialEntries={['/web/invite/1234']}> | ||
<Welcome /> | ||
</MemoryRouter> | ||
); | ||
|
||
export const AuthMfaOn = () => ( | ||
<MockedWelcome url="/web/invite/1234/continue" Form={MfaOn} /> | ||
export const WelcomeReset = () => ( | ||
<MemoryRouter initialEntries={['/web/reset/1234']}> | ||
<Welcome /> | ||
</MemoryRouter> | ||
); | ||
|
||
export const AuthMfaOptional = () => ( | ||
<MockedWelcome url="/web/invite/1234/continue" Form={MfaOptional} /> | ||
export const ExpiredInvite = () => ( | ||
<NewCredentials {...props} fetchAttempt={{ status: 'failed' }} /> | ||
); | ||
|
||
export const AuthMfaOnOtp = () => ( | ||
<MockedWelcome url="/web/invite/1234/continue" Form={Otp} /> | ||
export const ExpiredReset = () => ( | ||
<NewCredentials | ||
{...props} | ||
fetchAttempt={{ status: 'failed' }} | ||
resetMode={true} | ||
/> | ||
); | ||
|
||
const MfaOn = (props: Props) => ( | ||
<NewCredentials {...props} {...mockedProps} auth2faType="on" /> | ||
export const RecoveryCodesInvite = () => ( | ||
<NewCredentials {...props} recoveryCodes={recoveryCodes} /> | ||
); | ||
|
||
const Otp = (props: Props) => ( | ||
<NewCredentials {...props} {...mockedProps} auth2faType="otp" /> | ||
export const RecoveryCodesReset = () => ( | ||
<NewCredentials {...props} recoveryCodes={recoveryCodes} resetMode={true} /> | ||
); | ||
|
||
const MfaOptional = (props: Props) => ( | ||
<NewCredentials {...props} {...mockedProps} auth2faType="optional" /> | ||
); | ||
export const BasicForm = () => <NewCredentials {...props} />; | ||
|
||
type MockedWelcomeProps = { | ||
url: string; | ||
Form?: React.FC<Props>; | ||
const recoveryCodes = { | ||
codes: [ | ||
'tele-testword-testword-testword-testword-testword-testword-testword', | ||
'tele-testword-testword-testword-testword-testword-testword-testword-testword', | ||
'tele-testword-testword-testword-testword-testword-testword-testword', | ||
], | ||
createdDate: new Date('2019-08-30T11:00:00.00Z'), | ||
}; | ||
|
||
function MockedWelcome({ url, Form }: MockedWelcomeProps) { | ||
return ( | ||
<MemoryRouter initialEntries={[url]}> | ||
<Welcome CustomForm={Form} /> | ||
</MemoryRouter> | ||
); | ||
} | ||
|
||
GetStarted.storyName = 'GetStarted'; | ||
GetStartedReset.storyName = 'GetStartedReset'; | ||
ContinueReset.storyName = 'ContinueReset'; | ||
Continue.storyName = 'Continue'; | ||
AuthMfaOnOtp.storyName = 'MfaOnOtp'; | ||
AuthMfaOn.storyName = 'MfaOn'; | ||
AuthMfaOptional.storyName = 'MfaOptional'; | ||
const props: Props = { | ||
submitBtnText: 'Some Button Text', | ||
title: 'Some Title', | ||
auth2faType: 'off', | ||
preferredMfaType: 'webauthn', | ||
submitAttempt: { status: '' }, | ||
clearSubmitAttempt: () => null, | ||
fetchAttempt: { status: 'success' }, | ||
onSubmitWithWebauthn: () => null, | ||
onSubmit: () => null, | ||
redirect: () => null, | ||
recoveryCodes: null, | ||
passwordToken: { | ||
user: '[email protected]', | ||
tokenId: 'test123', | ||
qrCode: | ||
'iVBORw0KGgoAAAANSUhEUgAAAcgAAAHIEAAAAAC/Wvl1AAAJV0lEQVR4nOzdsW4jORZA0fbC///LXowV' + | ||
'TFIWmqAefUtzTrDJeEtltS+YPDx+fn39ASL+99svAPzr85//+fj47df4ycr5ff1bXD9h/2f3vcenTf0L' + | ||
'rTzh2tnvd9/jfZ2QECJICBEkhAgSQgQJIYKEEEFCiCAhRJAQIkgI+fz5P50dOz870rT/u3VH0VZ+dv+3' + | ||
'2B9mW1H41vc9e18nJIQIEkIECSGChBBBQoggIUSQECJICBEkhAgSQp6Mzl0rjCkV9stNjYytvG9hkOzs' + | ||
'+F5nxO3vrL+vExJCBAkhgoQQQUKIICFEkBAiSAgRJIQIEkIECSHLo3M8nB1bOztItv9pU8N3+59W54SE' + | ||
'EEFCiCAhRJAQIkgIESSECBJCBAkhgoQQQULIG43OvcdOs7NDZ9cKQ3L7o4n3HKhzQkKIICFEkBAiSAgR' + | ||
'JIQIEkIECSGChBBBQoggIWR5dO5uA0lT42Vnnzu1427/Hfaf0B2H+42/dSckhAgSQgQJIYKEEEFCiCAh' + | ||
'RJAQIkgIESSECBJCnozOTQ1mTdnfLzd1UenZcbjumF3hZ691/tadkBAiSAgRJIQIEkIECSGChBBBQogg' + | ||
'IUSQECJICPkenbvbJrlrZwez9t9h39khubPvcPY763BCQoggIUSQECJICBEkhAgSQgQJIYKEEEFCiCAh' + | ||
'5OPrq3FJ6LWpS0L3nzD1PUxdatp936l3uNZ9swcnJIQIEkIECSGChBBBQoggIUSQECJICBEkhAgSQkYv' + | ||
'bN3f8FW4SPPs1aErule+Fi6u7Xr2PTghIUSQECJICBEkhAgSQgQJIYKEEEFCiCAhRJAQ8jF5geV/b1Tq' + | ||
'7Ja8qecW9vedvVi1s4vOCQkhgoQQQUKIICFEkBAiSAgRJIQIEkIECSGChJDl0bnCoNOUs/vaCjv5pv7d' + | ||
'9jfUrTy3MGb3qt/CCQkhgoQQQUKIICFEkBAiSAgRJIQIEkIECSGChJAnF7ZeK1zFWbgA9ezPrji7HW7F' + | ||
'1PfQHai7Zusc3IQgIUSQECJICBEkhAgSQgQJIYKEEEFCiCAh5Hvr3NTw0oqzI3nda1GvFS65feffbZ+t' + | ||
'c/CGBAkhgoQQQUKIICFEkBAiSAgRJIQIEkIECSFPRudWnL189OwQ177uOxQGFqeeULhEeP3NnJAQIkgI' + | ||
'ESSECBJCBAkhgoQQQUKIICFEkBAiSAj5vrC1cLXlylDU2R13+084O1h47exut8K1viumBgvXn+CEhBBB' + | ||
'QoggIUSQECJICBEkhAgSQgQJIYKEEEFCyMfqWFdhO9yUV126+Xc/u/8OK+52Ke/KE/adHXm0dQ5uQpAQ' + | ||
'IkgIESSECBJCBAkhgoQQQUKIICFEkBDyZHTu7KjU3a58LexKu3Z2QO09LnedYusc3JogIUSQECJICBEk' + | ||
'hAgSQgQJIYKEEEFCiCAhZHnr3A+PGdppdvYJ+wq76M5+k1MDliu6G/XWOSEhRJAQIkgIESSECBJCBAkh' + | ||
'goQQQUKIICFEkBDy+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GChBBBQsjH11fjQtF93QG199gD173q' + | ||
'9D2+3wcnJIQIEkIECSGChBBBQoggIUSQECJICBEkhAgSQj7udknpn8Ehrv19Yt1Pu3Z2i9vZ8b2zI4+v' + | ||
'+h6ckBAiSAgRJIQIEkIECSGChBBBQoggIUSQECJICPm+sPXs1q4V1wNJ++NlZ6282f4w28oTCpfcFnYe' + | ||
'7n8Pr/rWnZAQIkgIESSECBJCBAkhgoQQQUKIICFEkBAiSAj5/Pk/nd1Hd3a8rKCw7+/sHrizQ3LXpj7t' + | ||
'Vc91QkKIICFEkBAiSAgRJIQIEkIECSGChBBBQoggIeTJ6Ny1qctSu87+xvvby1Z20Z21/y/f/Y1fNRbo' + | ||
'hIQQQUKIICFEkBAiSAgRJIQIEkIECSGChBBBQsjy6FzX1IjbynOnriQtvMOK7vewb2rn4eMJTkgIESSE' + | ||
'CBJCBAkhgoQQQUKIICFEkBAiSAgRJIS80ejc1IWtZy+CvdtOvmtTg3pTY3b772DrHLwhQUKIICFEkBAi' + | ||
'SAgRJIQIEkIECSGChBBBQsjy6FxhtGvlHaY2yV1beW7hCtV93d1uUz879WkPTkgIESSECBJCBAkhgoQQ' + | ||
'QUKIICFEkBAiSAgRJIQ8GZ3rjnbtD76d3X92ber60v0xsClnB9/OsnUO3pAgIUSQECJICBEkhAgSQgQJ' + | ||
'IYKEEEFCiCAh5KMwdgQ8OCEhRJAQ8v8AAAD//1QuL6EmJFBiAAAAAElFTkSuQmCC', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.