Skip to content

Commit

Permalink
fix(clerk-js): Fallback to FAPI error message for password pwned case (
Browse files Browse the repository at this point in the history
  • Loading branch information
desiprisg authored Dec 6, 2023
1 parent 12b3629 commit 6b59735
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/rare-bottles-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-js': patch
---

Fallback to the API error message when the password is pwned and there is no translation available.
2 changes: 1 addition & 1 deletion packages/clerk-js/src/ui/utils/passwordUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const createPasswordError = (errors: ClerkAPIError[], localizationConfig:
const { t, locale, passwordSettings } = localizationConfig;

if (errors?.[0]?.code === 'form_password_size_in_bytes_exceeded' || errors?.[0]?.code === 'form_password_pwned') {
return `${t(localizationKeys(`unstable__errors.${errors?.[0]?.code}` as any))}`;
return `${t(localizationKeys(`unstable__errors.${errors?.[0]?.code}` as any)) || errors?.[0]?.message}`;
}

if (errors?.[0]?.code === 'form_password_not_strong_enough') {
Expand Down

0 comments on commit 6b59735

Please sign in to comment.