fix: validate schedule title input to block invalid characters (#27818)
* fix(availability): validate schedule title input to block invalid characters * fix: add english translation for invalid_characters_in_name * fix(schedule): allow Unicode characters in schedule name validation * fix(schedule): update validation message to match regex * fix: tsconfig target * fix(schedule): add required validation in NewScheduleButton using translation * fix(schedule): allow ASCII apostrophe in schedule name validation * Update ScheduleListItem.tsx * fix: remove unused @ts-expect-error directives * fix: remove tsconfig target change * Revert "fix: remove tsconfig target change" This reverts commit d4992caf9b71cdfe32ac9db9a509128548097a30. * Revert "fix: remove unused @ts-expect-error directives" This reverts commit 913eda500aeccdd67b15cf1898f6db376bf3dda9. * fix: update validation regex to support unicode characters * fix: remove es6 from tsconfig * Update NewScheduleButton.tsx --------- Co-authored-by: Deepanshu Verma <deepanshuverma186@email.com> Co-authored-by: Sahitya Chandra <sahityajb@gmail.com>
This commit is contained in:
co-authored by
Deepanshu Verma
Sahitya Chandra
parent
11b65b295b
commit
20dcef6680
@@ -79,6 +79,14 @@ export function NewScheduleButton({
|
||||
placeholder={t("default_schedule_name")}
|
||||
{...register("name", {
|
||||
setValueAs: (v) => (!v || v.trim() === "" ? null : v),
|
||||
required:t('required'),
|
||||
pattern:{
|
||||
value: new RegExp(
|
||||
"^[\\p{L}\\p{M}\\p{N}\\s&\\-_'\\u2018\\u2019@.:,/]+$",
|
||||
"u"
|
||||
),
|
||||
message:t("invalid_characters_in_name"),
|
||||
}
|
||||
})}
|
||||
/>
|
||||
<DialogFooter>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"upgrade_now": "Upgrade now",
|
||||
"untitled": "Untitled",
|
||||
"accept_invitation": "Accept invitation",
|
||||
"invalid_characters_in_name": "Only letters, numbers, spaces, and supported punctuation are allowed.",
|
||||
"max_characters": "Max. characters",
|
||||
"min_characters": "Min. characters",
|
||||
"min_characters_required": "Min. {{count}} characters required",
|
||||
|
||||
Reference in New Issue
Block a user