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>>;
|
||||
};
|
||||
|
||||
const restrictedUrls = [
|
||||
"create-workspace",
|
||||
"error",
|
||||
"invitations",
|
||||
"magic-sign-in",
|
||||
"onboarding",
|
||||
"signin",
|
||||
];
|
||||
|
||||
export const CreateWorkspaceForm: React.FC<Props> = ({
|
||||
onSubmit,
|
||||
defaultValues,
|
||||
@ -49,7 +58,7 @@ export const CreateWorkspaceForm: React.FC<Props> = ({
|
||||
await workspaceService
|
||||
.workspaceSlugCheck(formData.slug)
|
||||
.then(async (res) => {
|
||||
if (res.status === true) {
|
||||
if (res.status === true && !restrictedUrls.includes(formData.slug)) {
|
||||
setSlugError(false);
|
||||
await workspaceService
|
||||
.createWorkspace(formData)
|
||||
|
Loading…
Reference in New Issue
Block a user