mirror of
https://github.com/Mintplex-Labs/vector-admin.git
synced 2026-07-19 13:16:03 -04:00
Merge pull request #94 from kschmelter13/patch-1
no special characters when creating organization
This commit is contained in:
@@ -18,6 +18,16 @@ const Organization = {
|
||||
};
|
||||
var slug = slugify(orgName, { lower: true });
|
||||
|
||||
const validNameRegex = /^[a-zA-Z0-9]+$/;
|
||||
|
||||
// Validate orgName against the regular expression
|
||||
if (!validNameRegex.test(orgName)) {
|
||||
return {
|
||||
organization: null,
|
||||
message: "Organization name contains invalid characters. Only alphanumeric characters are allowed.",
|
||||
};
|
||||
}
|
||||
|
||||
const existingBySlug = await this.get({ slug });
|
||||
if (!!existingBySlug) {
|
||||
const slugSeed = Math.floor(10000000 + Math.random() * 90000000);
|
||||
|
||||
Reference in New Issue
Block a user