Skip to content

Commit b41c0d5

Browse files
authored
fix(clerk-js,localizations,backend): Rename passwordUntrusted to passwordCompromised (#7352)
1 parent e89225d commit b41c0d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+200
-31
lines changed

.changeset/honest-pigs-move.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/backend': patch
3+
---
4+
5+
Rename `__experimental_passwordUntrusted` to `__experimental_passwordCompromised`

.changeset/moody-dryers-serve.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/localizations': patch
3+
---
4+
5+
Deprecating `passwordUntrusted` in favour of `passwordCompromised` and `form_password_untrusted__sign_in` to `form_password_compromised__sign_in`

.changeset/some-phones-report.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
'@clerk/shared': patch
4+
---
5+
6+
Rename internal `isPasswordUntrustedError` to `isPasswordCompromisedError`

integration/testUtils/usersService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export type UserService = {
7676
createFakeOrganization: (userId: string) => Promise<FakeOrganization>;
7777
getUser: (opts: { id?: string; email?: string }) => Promise<User | undefined>;
7878
createFakeAPIKey: (userId: string) => Promise<FakeAPIKey>;
79-
passwordUntrusted: (userId: string) => Promise<void>;
79+
passwordCompromised: (userId: string) => Promise<void>;
8080
};
8181

8282
/**
@@ -211,8 +211,8 @@ export const createUserService = (clerkClient: ClerkClient) => {
211211
revoke: () => clerkClient.apiKeys.revoke({ apiKeyId: apiKey.id, revocationReason: 'For testing purposes' }),
212212
} satisfies FakeAPIKey;
213213
},
214-
passwordUntrusted: async (userId: string) => {
215-
await clerkClient.users.__experimental_passwordUntrusted(userId);
214+
passwordCompromised: async (userId: string) => {
215+
await clerkClient.users.__experimental_passwordCompromised(userId);
216216
},
217217
};
218218

integration/tests/session-tasks-sign-in-reset-password.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasksResetPassword
1919
const user = u.services.users.createFakeUser();
2020
const createdUser = await u.services.users.createBapiUser(user);
2121

22-
await u.services.users.passwordUntrusted(createdUser.id);
22+
await u.services.users.passwordCompromised(createdUser.id);
2323

2424
// Performs sign-in
2525
await u.po.signIn.goTo();
@@ -66,7 +66,7 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasksResetPassword
6666
const user = u.services.users.createFakeUser();
6767
const createdUser = await u.services.users.createBapiUser(user);
6868

69-
await u.services.users.passwordUntrusted(createdUser.id);
69+
await u.services.users.passwordCompromised(createdUser.id);
7070
const fakeOrganization = u.services.organizations.createFakeOrganization();
7171
await u.services.organizations.createBapiOrganization({
7272
name: fakeOrganization.name,

packages/backend/src/api/endpoints/UserApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,11 @@ export class UserAPI extends AbstractAPI {
448448
});
449449
}
450450

451-
public async __experimental_passwordUntrusted(userId: string) {
451+
public async __experimental_passwordCompromised(userId: string) {
452452
this.requireId(userId);
453453
return this.request<User>({
454454
method: 'POST',
455-
path: joinPaths(basePath, userId, 'password_untrusted'),
455+
path: joinPaths(basePath, userId, 'password_compromised'),
456456
bodyParams: {
457457
revokeAllSessions: false,
458458
},

packages/clerk-js/src/ui/components/SignIn/AlternativeMethods.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { SignInSocialButtons } from './SignInSocialButtons';
1818
import { useResetPasswordFactor } from './useResetPasswordFactor';
1919
import { withHavingTrouble } from './withHavingTrouble';
2020

21-
export type AlternativeMethodsMode = 'forgot' | 'pwned' | 'passwordUntrusted' | 'default';
21+
export type AlternativeMethodsMode = 'forgot' | 'pwned' | 'passwordCompromised' | 'default';
2222

2323
export type AlternativeMethodsProps = {
2424
onBackLinkClick: React.MouseEventHandler | undefined;
@@ -55,7 +55,7 @@ const AlternativeMethodsList = (props: AlternativeMethodListProps) => {
5555
<Card.Content>
5656
<Header.Root showLogo>
5757
<Header.Title localizationKey={cardTitleKey} />
58-
{!isReset && mode !== 'passwordUntrusted' && (
58+
{!isReset && mode !== 'passwordCompromised' && (
5959
<Header.Subtitle localizationKey={localizationKeys('signIn.alternativeMethods.subtitle')} />
6060
)}
6161
</Header.Root>
@@ -185,8 +185,8 @@ function determineFlowPart(mode: AlternativeMethodsMode) {
185185
return 'forgotPasswordMethods';
186186
case 'pwned':
187187
return 'passwordPwnedMethods';
188-
case 'passwordUntrusted':
189-
return 'passwordUntrustedMethods';
188+
case 'passwordCompromised':
189+
return 'passwordCompromisedMethods';
190190
default:
191191
return 'alternativeMethods';
192192
}
@@ -198,8 +198,8 @@ function determineTitle(mode: AlternativeMethodsMode): LocalizationKey {
198198
return localizationKeys('signIn.forgotPasswordAlternativeMethods.title');
199199
case 'pwned':
200200
return localizationKeys('signIn.passwordPwned.title');
201-
case 'passwordUntrusted':
202-
return localizationKeys('signIn.passwordPwned.title');
201+
case 'passwordCompromised':
202+
return localizationKeys('signIn.passwordCompromised.title');
203203
default:
204204
return localizationKeys('signIn.alternativeMethods.title');
205205
}
@@ -210,7 +210,7 @@ function determineIsReset(mode: AlternativeMethodsMode): boolean {
210210
case 'forgot':
211211
case 'pwned':
212212
return true;
213-
case 'passwordUntrusted':
213+
case 'passwordCompromised':
214214
return false;
215215
default:
216216
return false;

packages/clerk-js/src/ui/components/SignIn/SignInFactorOne.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ function determineAlternativeMethodsMode(
5555
return 'pwned';
5656
}
5757

58-
if (passwordErrorCode === 'untrusted') {
59-
return 'passwordUntrusted';
58+
if (passwordErrorCode === 'compromised') {
59+
return 'passwordCompromised';
6060
}
6161

6262
return 'forgot';

packages/clerk-js/src/ui/components/SignIn/SignInFactorOnePasswordCard.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isPasswordPwnedError, isPasswordUntrustedError, isUserLockedError } from '@clerk/shared/error';
1+
import { isPasswordCompromisedError, isPasswordPwnedError, isUserLockedError } from '@clerk/shared/error';
22
import { useClerk } from '@clerk/shared/react';
33
import React from 'react';
44

@@ -18,7 +18,7 @@ import { useRouter } from '../../router/RouteContext';
1818
import { HavingTrouble } from './HavingTrouble';
1919
import { useResetPasswordFactor } from './useResetPasswordFactor';
2020

21-
export type PasswordErrorCode = 'untrusted' | 'pwned';
21+
export type PasswordErrorCode = 'compromised' | 'pwned';
2222

2323
type SignInFactorOnePasswordProps = {
2424
onForgotPasswordMethodClick: React.MouseEventHandler | undefined;
@@ -101,9 +101,9 @@ export const SignInFactorOnePasswordCard = (props: SignInFactorOnePasswordProps)
101101
return;
102102
}
103103

104-
if (isPasswordUntrustedError(err)) {
105-
card.setError({ ...err.errors[0], code: 'form_password_untrusted__sign_in' });
106-
onPasswordError('untrusted');
104+
if (isPasswordCompromisedError(err)) {
105+
card.setError({ ...err.errors[0], code: 'form_password_compromised__sign_in' });
106+
onPasswordError('compromised');
107107
return;
108108
}
109109
}

packages/clerk-js/src/ui/components/SignIn/__tests__/SignInFactorOne.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ describe('SignInFactorOne', () => {
353353
).not.toBeInTheDocument();
354354
});
355355

356-
it('using an untrusted password should show the untrusted password screen', async () => {
356+
it('using an compromised password should show the compromised password screen', async () => {
357357
const { wrapper, fixtures } = await createFixtures(f => {
358358
f.withEmailAddress();
359359
f.withPassword();
@@ -367,7 +367,7 @@ describe('SignInFactorOne', () => {
367367
fixtures.signIn.prepareFirstFactor.mockReturnValueOnce(Promise.resolve({} as SignInResource));
368368

369369
const errJSON = {
370-
code: 'form_password_untrusted',
370+
code: 'form_password_compromised',
371371
long_message:
372372
"Your password appears to have been compromised or it's no longer trusted and cannot be used. Please use another method to continue.",
373373
message:
@@ -393,7 +393,7 @@ describe('SignInFactorOne', () => {
393393
await screen.findByText('Email code to hello@clerk.com');
394394
});
395395

396-
it('Prompts the user to use a different method if the password is untrusted', async () => {
396+
it('Prompts the user to use a different method if the password is compromised', async () => {
397397
const { wrapper, fixtures } = await createFixtures(f => {
398398
f.withEmailAddress();
399399
f.withPassword();
@@ -408,7 +408,7 @@ describe('SignInFactorOne', () => {
408408
fixtures.signIn.prepareFirstFactor.mockReturnValueOnce(Promise.resolve({} as SignInResource));
409409

410410
const errJSON = {
411-
code: 'form_password_untrusted',
411+
code: 'form_password_compromised',
412412
long_message:
413413
"Your password appears to have been compromised or it's no longer trusted and cannot be used. Please use another method to continue.",
414414
message:

0 commit comments

Comments
 (0)