Fix comments explaining "international" password requirements

This commit is contained in:
Joel Biddle
2023-08-23 01:41:37 +10:00
parent b2888272f2
commit 2960f86647

View File

@@ -49,13 +49,17 @@ const checkPassword = async ({ password, setErrors }: CheckPasswordParams): Prom
}
// upperCase
// this adds support for the user to select an uppercase character from many major languages
// NB. ES2018 is required to run this
if (!/[A-Z\u0041-\u005A\u00C0-\u00D6\u00D8-\u00DE]/.test(password)) {
errors.upperCase = "at least 1 uppercase character (A-Z)";
errors.upperCase = "at least 1 uppercase character"; // most major langauges supported
}
// lowerCase
// this adds support for the user to select a lowercase character from many major languages
// NB. ES2018 is required to run this
if (!/[a-z\u0061-\u007A\u00DF-\u00F6\u00F8-\u00FF]/.test(password)) {
errors.lowerCase = "at least 1 lowercase character (a-z)";
errors.lowerCase = "at least 1 lowercase character"; // most major langauges supported
}
// number
@@ -64,16 +68,20 @@ const checkPassword = async ({ password, setErrors }: CheckPasswordParams): Prom
}
// specialChar
// this adds support for the user to select a special character from many major languages and emojis
// NB. ES2018 is required to run this
if (
!/[!@#$%^&*(),.?":{}|<>\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FFF\u0600-\u06FF\u0400-\u04FF\u0500-\u052F\u2DE0-\u2DFF\uA640-\uA69F\u05B0-\u05FF\u0980-\u09FF\u1F00-\u1FFF\u0130\u015E\u011E\u00D6\u00C7\u00FC\u00FB\u00F6\u00EB\u00E7\u00C7\p{Emoji}]/u.test(
password
)
) {
errors.specialChar =
'at least 1 special character from !@#$%^&*(),.?":{}|<>, Japanese, Korean, Arabic, Cyrillic, Greek, Devanagari, Turkish, or an emoji';
'at least 1 special character from !@#$%^&*(),.?":{}|<> or many languages including Korean, Devanagari, Cyrillic, Turkish and emojis.';
}
// repeatedChar
// this prevents the user from selecting repeated characters from many major languages, emojis as well as numbers and symbols
// NB. ES2018 is required to run this
if (
/([!@#$%^&*(),.?":{}|<>0-9A-Za-z\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FFF\u0600-\u06FF\u0400-\u04FF\u0500-\u052F\u2DE0-\u2DFF\uA640-\uA69F\u05B0-\u05FF\u0980-\u09FF\u1F00-\u1FFF\u0130\u015E\u011E\u00D6\u00C7\u00FC\u00FB\u00F6\u00EB\u00E7\u00C7\u003a-\u003f\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\p{Emoji}])\1\1/.test(
password