Skip to content

Commit d61ea65

Browse files
authored
Revert "fix(clerk-js): If password is enabled, instanceIsPasswordBased is true (#6599)" (#6643)
1 parent f871573 commit d61ea65

File tree

6 files changed

+7
-20
lines changed

6 files changed

+7
-20
lines changed

.changeset/khaki-ravens-cheer.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/lemon-paths-brake.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/clerk-js/src/core/resources/UserSettings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export class UserSettings extends BaseResource implements UserSettingsResource {
191191
}
192192

193193
get instanceIsPasswordBased() {
194-
return Boolean(this.attributes?.password?.enabled);
194+
return Boolean(this.attributes?.password?.enabled && this.attributes.password?.required);
195195
}
196196

197197
get hasValidAuthFactor() {

packages/clerk-js/src/core/resources/__tests__/UserSettings.spec.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,6 @@ describe('UserSettings', () => {
7575
},
7676
},
7777
} as any as UserSettingsJSON);
78-
79-
expect(sut.instanceIsPasswordBased).toEqual(true);
80-
81-
sut = new UserSettings({
82-
attributes: {
83-
password: {
84-
enabled: false,
85-
required: false,
86-
},
87-
},
88-
} as any as UserSettingsJSON);
89-
9078
expect(sut.instanceIsPasswordBased).toEqual(false);
9179
});
9280

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ describe('SignInStart', () => {
476476
it(`calls sign in with identifier again with only the email if the api respondes with the error ${code}`, async () => {
477477
const { wrapper, fixtures } = await createFixtures(f => {
478478
f.withEmailAddress();
479-
f.withPassword();
479+
f.withPassword({ required: true });
480480
});
481481

482482
const errJSON = {

packages/clerk-js/src/ui/components/UserProfile/__tests__/SecurityPage.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ describe('SecurityPage', () => {
3232

3333
it('renders the Password section if instance is password based', async () => {
3434
const { wrapper, fixtures } = await createFixtures(f => {
35-
f.withPassword();
35+
f.withPassword({
36+
required: true,
37+
});
3638
f.withUser({ email_addresses: ['[email protected]'] });
3739
});
3840
fixtures.clerk.user?.getSessions.mockReturnValue(Promise.resolve([]));

0 commit comments

Comments
 (0)