Skip to content

Commit 0b19247

Browse files
chore(repo): Cherry pick compromised password screen changes (#7356)
Co-authored-by: Laura Beatris <48022589+LauraBeatris@users.noreply.github.com>
1 parent 81c164d commit 0b19247

Some content is hidden

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

60 files changed

+530
-31
lines changed

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: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test } from '@playwright/test';
1+
import { expect, test } from '@playwright/test';
22

33
import { hash } from '../models/helpers';
44
import { appConfigs } from '../presets';
@@ -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();
@@ -28,6 +28,13 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasksResetPassword
2828
await u.po.signIn.setPassword(user.password);
2929
await u.po.signIn.continue();
3030

31+
await expect(
32+
u.page.getByText(
33+
"Your password appears to have been compromised or it's no longer trusted and cannot be used. Please use another method to continue.",
34+
),
35+
).toBeVisible();
36+
await u.po.signIn.getAltMethodsEmailCodeButton().click();
37+
3138
await u.page.getByRole('textbox', { name: 'code' }).click();
3239
await u.page.keyboard.type('424242', { delay: 100 });
3340

@@ -59,10 +66,11 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasksResetPassword
5966
const user = u.services.users.createFakeUser();
6067
const createdUser = await u.services.users.createBapiUser(user);
6168

62-
await u.services.users.passwordUntrusted(createdUser.id);
69+
await u.services.users.passwordCompromised(createdUser.id);
6370
const fakeOrganization = u.services.organizations.createFakeOrganization();
6471
await u.services.organizations.createBapiOrganization({
65-
...fakeOrganization,
72+
name: fakeOrganization.name,
73+
slug: fakeOrganization.slug + Date.now().toString(),
6674
createdBy: createdUser.id,
6775
});
6876

@@ -73,9 +81,15 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasksResetPassword
7381
await u.po.signIn.setPassword(user.password);
7482
await u.po.signIn.continue();
7583

76-
await u.page.getByRole('textbox', { name: 'code' }).fill('424242');
84+
await expect(
85+
u.page.getByText(
86+
"Your password appears to have been compromised or it's no longer trusted and cannot be used. Please use another method to continue.",
87+
),
88+
).toBeVisible();
89+
await u.po.signIn.getAltMethodsEmailCodeButton().click();
7790

78-
await u.po.expect.toBeSignedIn();
91+
await u.page.getByRole('textbox', { name: 'code' }).click();
92+
await u.page.keyboard.type('424242', { delay: 100 });
7993

8094
// Redirects back to tasks when accessing protected route by `auth.protect`
8195
await u.page.goToRelative('/page-protected');

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/localizations/src/ar-SA.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,9 +690,15 @@ export const arSA: LocalizationResource = {
690690
subtitle: 'للمتابعة إلى {{applicationName}}',
691691
title: 'ادخل كلمة المرور',
692692
},
693+
passwordCompromised: {
694+
title: undefined,
695+
},
693696
passwordPwned: {
694697
title: 'كلمة المرور غير آمنة',
695698
},
699+
passwordUntrusted: {
700+
title: undefined,
701+
},
696702
phoneCode: {
697703
formTitle: 'رمز التحقق',
698704
resendButton: 'لم يصلك الرمز؟ حاول مرة أخرى',
@@ -895,6 +901,7 @@ export const arSA: LocalizationResource = {
895901
form_password_pwned__sign_in: 'لا يمكن أستعمال كلمة السر هذه لانها غير أمنة, الرجاء اختيار كلمة مرور أخرى',
896902
form_password_size_in_bytes_exceeded:
897903
'تجاوزت كلمة المرور الحد الأقصى للحروف المدخلة, الرجاء أدخال كلمة مرور أقصر أو حذف بعض الأحرف الخاصة',
904+
form_password_untrusted__sign_in: undefined,
898905
form_password_validation_failed: 'كلمة مرور خاطئة',
899906
form_username_invalid_character: undefined,
900907
form_username_invalid_length: undefined,

packages/localizations/src/be-BY.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,15 @@ export const beBY: LocalizationResource = {
697697
subtitle: 'каб працягнуць працу ў "{{applicationName}}"',
698698
title: 'Увядзіце пароль',
699699
},
700+
passwordCompromised: {
701+
title: undefined,
702+
},
700703
passwordPwned: {
701704
title: 'Пароль быў узламаны',
702705
},
706+
passwordUntrusted: {
707+
title: undefined,
708+
},
703709
phoneCode: {
704710
formTitle: 'Код верыфікацыі',
705711
resendButton: 'Пераадправіць код',
@@ -904,6 +910,7 @@ export const beBY: LocalizationResource = {
904910
form_password_pwned__sign_in: 'Гэты пароль быў узламаны, калі ласка, абярыце іншы.',
905911
form_password_size_in_bytes_exceeded:
906912
'Ваш пароль перавышае максімальна дапушчальнае колькасць байтаў, скараціце яго або выдаліце некаторыя спецыяльныя сімвалы.',
913+
form_password_untrusted__sign_in: undefined,
907914
form_password_validation_failed: 'Неверагодны пароль',
908915
form_username_invalid_character: 'Імя карыстальніка змяшчае недапушчальныя сімвалы.',
909916
form_username_invalid_length: 'Імя карыстальніка павінна быць ад 3 да 50 сімвалаў.',

packages/localizations/src/bg-BG.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,9 +693,15 @@ export const bgBG: LocalizationResource = {
693693
subtitle: 'Въведете паролата, свързана с вашия акаунт',
694694
title: 'Въведете вашата парола',
695695
},
696+
passwordCompromised: {
697+
title: undefined,
698+
},
696699
passwordPwned: {
697700
title: undefined,
698701
},
702+
passwordUntrusted: {
703+
title: undefined,
704+
},
699705
phoneCode: {
700706
formTitle: 'Код за потвърждение',
701707
resendButton: 'Не сте получили код? Изпрати отново',
@@ -897,6 +903,7 @@ export const bgBG: LocalizationResource = {
897903
form_password_pwned: 'Тази парола е компрометирана в изтекли данни. Моля, изберете друга.',
898904
form_password_pwned__sign_in: undefined,
899905
form_password_size_in_bytes_exceeded: 'Паролата ви е твърде дълга. Моля, съкратете я.',
906+
form_password_untrusted__sign_in: undefined,
900907
form_password_validation_failed: 'Невалидна парола.',
901908
form_username_invalid_character: 'Потребителското име съдържа невалидни символи.',
902909
form_username_invalid_length: 'Потребителското име трябва да бъде между 3 и 256 символа.',

packages/localizations/src/bn-IN.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,9 +696,15 @@ export const bnIN: LocalizationResource = {
696696
subtitle: 'আপনার অ্যাকাউন্টের সাথে যুক্ত পাসওয়ার্ড লিখুন',
697697
title: 'আপনার পাসওয়ার্ড লিখুন',
698698
},
699+
passwordCompromised: {
700+
title: undefined,
701+
},
699702
passwordPwned: {
700703
title: 'পাসওয়ার্ড সমঝোতা হয়েছে',
701704
},
705+
passwordUntrusted: {
706+
title: undefined,
707+
},
702708
phoneCode: {
703709
formTitle: 'যাচাইকরণ কোড',
704710
resendButton: 'কোনো কোড পাননি? পুনরায় পাঠান',
@@ -906,6 +912,7 @@ export const bnIN: LocalizationResource = {
906912
'এই পাসওয়ার্ডটি একটি ডেটা লঙ্ঘনের অংশ হিসাবে পাওয়া গেছে এবং ব্যবহার করা যাবে না, দয়া করে আপনার পাসওয়ার্ড রিসেট করুন।',
907913
form_password_size_in_bytes_exceeded:
908914
'আপনার পাসওয়ার্ড অনুমোদিত সর্বাধিক বাইট সংখ্যা অতিক্রম করেছে, দয়া করে এটি ছোট করুন বা কিছু বিশেষ অক্ষর সরান।',
915+
form_password_untrusted__sign_in: undefined,
909916
form_password_validation_failed: 'ভুল পাসওয়ার্ড',
910917
form_username_invalid_character:
911918
'আপনার ব্যবহারকারীর নামে অবৈধ অক্ষর রয়েছে। দয়া করে শুধুমাত্র অক্ষর, সংখ্যা এবং আন্ডারস্কোর ব্যবহার করুন।',

packages/localizations/src/ca-ES.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,9 +693,15 @@ export const caES: LocalizationResource = {
693693
subtitle: 'Introdueix la contrasenya associada al teu compte',
694694
title: 'Introdueix la teva contrasenya',
695695
},
696+
passwordCompromised: {
697+
title: undefined,
698+
},
696699
passwordPwned: {
697700
title: undefined,
698701
},
702+
passwordUntrusted: {
703+
title: undefined,
704+
},
699705
phoneCode: {
700706
formTitle: 'Codi de verificació',
701707
resendButton: 'No has rebut el codi? Reenvia',
@@ -899,6 +905,7 @@ export const caES: LocalizationResource = {
899905
form_password_pwned__sign_in: undefined,
900906
form_password_size_in_bytes_exceeded:
901907
'La teva contrasenya ha superat el nombre màxim de bytes permesos, si us plau, redueix-la o elimina alguns caràcters especials.',
908+
form_password_untrusted__sign_in: undefined,
902909
form_password_validation_failed: 'Contrasenya incorrecta',
903910
form_username_invalid_character: "El nom d'usuari conté caràcters no vàlids.",
904911
form_username_invalid_length: "El nom d'usuari ha de tenir entre 3 i 50 caràcters.",

packages/localizations/src/cs-CZ.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,9 +701,15 @@ export const csCZ: LocalizationResource = {
701701
subtitle: 'Zadejte heslo spojené s vaším účtem',
702702
title: 'Zadejte své heslo',
703703
},
704+
passwordCompromised: {
705+
title: undefined,
706+
},
704707
passwordPwned: {
705708
title: 'Heslo kompromitováno',
706709
},
710+
passwordUntrusted: {
711+
title: undefined,
712+
},
707713
phoneCode: {
708714
formTitle: 'Ověřovací kód',
709715
resendButton: 'Neobdrželi jste kód? Znovu poslat',
@@ -910,6 +916,7 @@ export const csCZ: LocalizationResource = {
910916
'Toto heslo bylo nalezeno jako součást prolomení a nelze ho použít, prosím resetujte si heslo.',
911917
form_password_size_in_bytes_exceeded:
912918
'Vaše heslo překročilo maximální povolený počet bajtů, prosím zkrátit ho nebo odstranit některé speciální znaky.',
919+
form_password_untrusted__sign_in: undefined,
913920
form_password_validation_failed: 'Nesprávné heslo',
914921
form_username_invalid_character: 'Uživatelské jméno může obsahovat pouze alfanumerické znaky a podtržítka.',
915922
form_username_invalid_length: 'Vaše uživatelské jméno musí mít mezi {{min_length}} a {{max_length}} znaky.',

packages/localizations/src/da-DK.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,15 @@ export const daDK: LocalizationResource = {
692692
subtitle: 'Fortsæt til {{applicationName}}',
693693
title: 'Indtast din adgangskode',
694694
},
695+
passwordCompromised: {
696+
title: undefined,
697+
},
695698
passwordPwned: {
696699
title: 'Sikkerhedsadvarsel',
697700
},
701+
passwordUntrusted: {
702+
title: undefined,
703+
},
698704
phoneCode: {
699705
formTitle: 'Bekræftelseskode',
700706
resendButton: 'Send kode igen',
@@ -896,6 +902,7 @@ export const daDK: LocalizationResource = {
896902
form_password_pwned__sign_in: 'Din adgangskode er blevet kompromitteret, vælg en ny.',
897903
form_password_size_in_bytes_exceeded:
898904
'Din adgangskode har overskredet det maksimalt tilladte antal bytes, forkort den eller fjern nogle specialtegn.',
905+
form_password_untrusted__sign_in: undefined,
899906
form_password_validation_failed: 'Forkert adgangskode.',
900907
form_username_invalid_character: 'Brugernavnet indeholder ugyldige tegn.',
901908
form_username_invalid_length: 'Brugernavnet har en ugyldig længde.',

0 commit comments

Comments
 (0)