Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

internationalize password requirements

Joel Biddlebe08417c8bbd
diff --git a/frontend/src/components/utilities/checks/PasswordCheck.ts b/frontend/src/components/utilities/checks/PasswordCheck.ts
index be0a275f40..88b1394a18 100644
--- a/frontend/src/components/utilities/checks/PasswordCheck.ts
+++ b/frontend/src/components/utilities/checks/PasswordCheck.ts
@@ -70,7 +70,11 @@ const passwordCheck = async ({
}
// specialChar
- if (!/[!@#$%^&*(),.?":{}|<>]/.test(password)) {
+ if (
+ !/[!@#$%^&*(),.?":{}|<>\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}\p{Script=Arabic}\p{Script=Cyrillic}\p{Script=Cyrillic_Supplement}\p{Script=Cyrillic_Extended_A}\p{Script=Cyrillic_Extended_B}\p{Script=Cyrillic_Extended_C}\p{Script=Cyrillic_Extended_D}\p{Script=Ukrainian}\p{Script=Farsi}\p{Emoji}]/u.test(
+ password
+ )
+ ) {
setPasswordErrorSpecialChar(true);
errorCheck = true;
} else {
diff --git a/frontend/src/components/utilities/checks/checkPassword.ts b/frontend/src/components/utilities/checks/checkPassword.ts
index aaa8bac7fb..15393d79d6 100644
--- a/frontend/src/components/utilities/checks/checkPassword.ts
+++ b/frontend/src/components/utilities/checks/checkPassword.ts
@@ -43,7 +43,7 @@ const checkPassword = async ({ password, setErrors }: CheckPasswordParams): Prom
errors.tooShort = "at least 14 characters";
}
- // toolong
+ // tooLong
if (password.length > 100) {
errors.tooLong = "at most 100 characters";
}
@@ -64,8 +64,13 @@ const checkPassword = async ({ password, setErrors }: CheckPasswordParams): Prom
}
// specialChar
- if (!/[!@#$%^&*(),.?":{}|<>]/.test(password)) {
- errors.specialChar = "at least 1 special character (!@#$%^&*(),.?)";
+ if (
+ !/[!@#$%^&*(),.?":{}|<>\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}\p{Script=Arabic}\p{Script=Cyrillic}\p{Script=Cyrillic_Supplement}\p{Script=Cyrillic_Extended_A}\p{Script=Cyrillic_Extended_B}\p{Script=Cyrillic_Extended_C}\p{Script=Cyrillic_Extended_D}\p{Script=Ukrainian}\p{Script=Farsi}\p{Emoji}]/u.test(
+ password
+ )
+ ) {
+ errors.specialChar =
+ 'at least 1 special character (!@#$%^&*(),.?":{}|<>), Japanese, Korean, Arabic, Cyrillic, Ukrainian, Farsi, or an emoji';
}
// repeatedChar
@@ -76,7 +81,7 @@ const checkPassword = async ({ password, setErrors }: CheckPasswordParams): Prom
// breachedPassword
if (await checkIsPasswordBreached(password)) {
errors.isBreachedPassword =
- "The password you provided is in a list of passwords commonly used on other websites. Please try again with a stronger password.";
+ "The provided password is in a list of passwords commonly used on other websites. Please try again with a stronger password.";
}
setErrors(errors);