disallow reserved chars from status page valiation

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

View File

@@ -73,6 +73,8 @@ const TabSettings = ({
label="Your status page address"
value={form.url}
onChange={handleFormChange}
helperText={errors["url"]}
error={errors["url"] ? true : false}
/>
</Stack>
</ConfigBox>

View File

@@ -222,7 +222,14 @@ const statusPageValidation = joi.object({
.string()
.trim()
.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." }),
color: joi.string().trim().messages({ "string.empty": "Color is required." }),
theme: joi.string(),