Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wise-olives-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-js': patch
---

When password is enabled at the instance level, but not required allow users to add a password in the user profile.
2 changes: 1 addition & 1 deletion packages/clerk-js/src/core/resources/UserSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class UserSettings extends BaseResource implements UserSettingsResource {
}

get instanceIsPasswordBased() {
return Boolean(this.attributes?.password?.enabled && this.attributes.password?.required);
return Boolean(this.attributes?.password?.enabled);
}

get hasValidAuthFactor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ describe('UserSettings', () => {
},
},
} as any as UserSettingsJSON);
expect(sut.instanceIsPasswordBased).toEqual(true);

sut = new UserSettings({
attributes: {
password: {
enabled: false,
required: false,
},
},
} as any as UserSettingsJSON);

expect(sut.instanceIsPasswordBased).toEqual(false);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ describe('SecurityPage', () => {

it('renders the Password section if instance is password based', async () => {
const { wrapper, fixtures } = await createFixtures(f => {
f.withPassword({
required: true,
});
f.withPassword();
f.withUser({ email_addresses: ['test@clerk.com'] });
});
fixtures.clerk.user?.getSessions.mockReturnValue(Promise.resolve([]));
Expand Down