-
Notifications
You must be signed in to change notification settings - Fork 395
feat(clerk-js,types,nextjs,localizations,clerk-react): Introduce UserVerification as experimental #4016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(clerk-js,types,nextjs,localizations,clerk-react): Introduce UserVerification as experimental #4016
Conversation
🦋 Changeset detectedLatest commit: 0e5d8d2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
c2a8280
to
efd5e79
Compare
efd5e79
to
ee6706a
Compare
28a6490
to
02aea2a
Compare
routing: 'virtual', | ||
}} | ||
> | ||
{/*TODO: Used by InvisibleRootBox, can we simplify? */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reviewers: Carried from SignIn
fb4b3ea
to
8cb52f6
Compare
export function useAlternativeStrategies({ | ||
filterOutFactor, | ||
supportedFirstFactors: _supportedFirstFactors, | ||
}: { | ||
filterOutFactor: SignInFactor | null | undefined; | ||
supportedFirstFactors: SignInFirstFactor[] | null | undefined; | ||
}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reviewers: I made this change in order to share the functionality across SignIn and UserVerification. Simply having the caller doing const { supportedFirstFactors } = useCoreSignIn();
seems like a good trade off.
{/*<input*/} | ||
{/* readOnly*/} | ||
{/* id='identifier-field'*/} | ||
{/* name='identifier'*/} | ||
{/* value={signIn.identifier || ''}*/} | ||
{/* style={{ display: 'none' }}*/} | ||
{/*/>*/} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chanioxaris any ideas what we can use to solve this while the user is signed in ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use the existing function that picks up the identifier based on the user attributes
packages/localizations/src/en-US.ts
Outdated
getHelp: { | ||
blockButton__emailSupport: 'Email support', | ||
content: | ||
'If you’re experiencing difficulty signing into your account, email us and we will work with you to restore access as soon as possible.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All items are the same as sign in, except this one (2/2)
packages/localizations/src/en-US.ts
Outdated
content: | ||
'If you’re experiencing difficulty verifying your account, email us and we will work with you to restore access as soon as possible.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All items are the same as sign in, except this one (2/4)
actionText: 'Don’t have any of these?', | ||
blockButton__backupCode: 'Use a backup code', | ||
blockButton__emailCode: 'Email code to {{identifier}}', | ||
blockButton__password: 'Continue with your password', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All items are the same as sign in, except this one (1/4)
388258a
to
c0fa2c3
Compare
…-component # Conflicts: # packages/clerk-js/bundlewatch.config.json # packages/clerk-js/src/ui/components/SignIn/SignInFactorOne.tsx # packages/clerk-js/src/ui/components/SignIn/SignInFactorOnePasswordCard.tsx # packages/clerk-js/src/ui/lazyModules/components.ts
'If you’re experiencing difficulty verifying your account, email us and we will work with you to restore access as soon as possible.', | ||
title: 'Get help', | ||
}, | ||
subtitle: 'Facing issues? You can use any of these methods for verification.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All items are the same as sign in, except this one (3/4)
title: 'Check your email', | ||
}, | ||
noAvailableMethods: { | ||
message: "Cannot proceed with verification. There's no available authentication factor.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All items are the same as sign in, except this one (4/4)
packages/clerk-js/src/ui/components/UserVerification/AlternativeMethods.tsx
Show resolved
Hide resolved
}); | ||
}); | ||
|
||
it.todo('renders the component for with strategy:phone_code'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO
packages/clerk-js/src/ui/components/UserVerification/__tests__/UVFactorOne.test.tsx
Show resolved
Hide resolved
describe('Use another method', () => { | ||
it.todo('should list enabled first factor methods without the current one'); | ||
}); | ||
|
||
describe('Get Help', () => { | ||
it.todo('should render the get help component when clicking the "Get Help" button'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODOs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These will be added in a future PR (soon)
@@ -0,0 +1,135 @@ | |||
import type { __experimental_SessionVerificationFirstFactor, SignInFactor } from '@clerk/types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ @panteliselef what do you think about renaming this file to something UVFactorOneAlternativeMethods
so it can match UVFactorTwoAlternativeMethods
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no problem, there is a great chance that event the UV prefix will be replaced in the coming days as the component name is not final yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
Description
This PR introduces a new UI component called UserVerification as experimental. The new UI component allows for a user to "re-enter" their credentials (1fa/2fa) which results in them being reverified.
<UserVerification/>
allows developers to easily build flows where verification is required before performing a sensitive action like updating other stored credentials or an application specific action like making a bank transfer.Unit tests have been added which should make reviewers more confident. But more will follow (maybe some e2es) before the official launch.
APIs
clerk-js
clerk-react
2fa flow (the default)
default.mov
1fa flow
1fa.mov
multi factor flow (the above two combined)
mfa.mov
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change