mirror of
https://github.com/outline/outline.git
synced 2026-01-06 11:09:55 -06:00
fix: Add 10 domain limit per team (#3733)
* fix: Validate team domains are FQDN's Add 10 domain limit per team fix: Deletion of domains not happening within request lifecycle * tests * docs
This commit is contained in:
17
server/models/validators/IsFQDN.ts
Normal file
17
server/models/validators/IsFQDN.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { isFQDN } from "class-validator";
|
||||
import { addAttributeOptions } from "sequelize-typescript";
|
||||
|
||||
/**
|
||||
* A decorator that validates that a string is a fully qualified domain name.
|
||||
*/
|
||||
export default function IsFQDN(target: any, propertyName: string) {
|
||||
return addAttributeOptions(target, propertyName, {
|
||||
validate: {
|
||||
validDomain(value: string) {
|
||||
if (!isFQDN(value)) {
|
||||
throw new Error("Must be a fully qualified domain name");
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user