forked from github/plane
chore: restrict users from creating workspace with reserved slugs (#692)
This commit is contained in:
parent
588247f1c1
commit
4af5921991
@ -27,6 +27,15 @@ type Props = {
|
|||||||
setDefaultValues: Dispatch<SetStateAction<any>>;
|
setDefaultValues: Dispatch<SetStateAction<any>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const restrictedUrls = [
|
||||||
|
"create-workspace",
|
||||||
|
"error",
|
||||||
|
"invitations",
|
||||||
|
"magic-sign-in",
|
||||||
|
"onboarding",
|
||||||
|
"signin",
|
||||||
|
];
|
||||||
|
|
||||||
export const CreateWorkspaceForm: React.FC<Props> = ({
|
export const CreateWorkspaceForm: React.FC<Props> = ({
|
||||||
onSubmit,
|
onSubmit,
|
||||||
defaultValues,
|
defaultValues,
|
||||||
@ -49,7 +58,7 @@ export const CreateWorkspaceForm: React.FC<Props> = ({
|
|||||||
await workspaceService
|
await workspaceService
|
||||||
.workspaceSlugCheck(formData.slug)
|
.workspaceSlugCheck(formData.slug)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
if (res.status === true) {
|
if (res.status === true && !restrictedUrls.includes(formData.slug)) {
|
||||||
setSlugError(false);
|
setSlugError(false);
|
||||||
await workspaceService
|
await workspaceService
|
||||||
.createWorkspace(formData)
|
.createWorkspace(formData)
|
||||||
|
Loading…
Reference in New Issue
Block a user