disallow reserved chars from status page valiation

This commit is contained in:
Alex Holliday committed 2025-03-03 14:16:24 -08:00
1 parent f7f80d2ba0
commit 457c187240
2 files changed
+10 -1

No files matched your search

@@ -73,6 +73,8 @@ const TabSettings = ({
label="Your status page address" label="Your status page address"
value={form.url} value={form.url}
onChange={handleFormChange} onChange={handleFormChange}
helperText={errors["url"]}
error={errors["url"] ? true : false}
/> />
</Stack> </Stack>
</ConfigBox> </ConfigBox>
+8 -1
View File
@@ -222,7 +222,14 @@ const statusPageValidation = joi.object({
.string() .string()
.trim() .trim()
.messages({ "string.empty": "Company name is required." }), .messages({ "string.empty": "Company name is required." }),
url: joi.string().trim().messages({ "string.empty": "URL is required." }), url: joi
.string()
.pattern(/^[a-zA-Z0-9_-]+$/) // Only allow alphanumeric, underscore, and hyphen
.required()
.messages({
"string.pattern.base":
"URL can only contain letters, numbers, underscores, and hyphens",
}),
timezone: joi.string().trim().messages({ "string.empty": "Timezone is required." }), timezone: joi.string().trim().messages({ "string.empty": "Timezone is required." }),
color: joi.string().trim().messages({ "string.empty": "Color is required." }), color: joi.string().trim().messages({ "string.empty": "Color is required." }),
theme: joi.string(), theme: joi.string(),