This commit is contained in:
commit
421043c9b5
67 changed files with 3455 additions and 0 deletions
37
environment/constants/validation.ts
Normal file
37
environment/constants/validation.ts
Normal file
|
@ -0,0 +1,37 @@
|
|||
import type { genericValidation } from "#types/lib";
|
||||
|
||||
const nameRestrictions: genericValidation = {
|
||||
length: { min: 3, max: 20 },
|
||||
regex: /^[\p{L}\p{N}._-]+$/u,
|
||||
};
|
||||
|
||||
const displayNameRestrictions: genericValidation = {
|
||||
length: { min: 1, max: 32 },
|
||||
regex: /^[\p{L}\p{N}\p{M}\p{S}\p{P}\s]+$/u,
|
||||
};
|
||||
|
||||
const forbiddenDisplayNamePatterns = [
|
||||
/[\r\n\t]/,
|
||||
/\s{3,}/,
|
||||
/^\s|\s$/,
|
||||
/#everyone|#here/i,
|
||||
/\p{Cf}/u,
|
||||
/\p{Cc}/u,
|
||||
];
|
||||
|
||||
const passwordRestrictions: genericValidation = {
|
||||
length: { min: 12, max: 64 },
|
||||
regex: /^(?=.*\p{Ll})(?=.*\p{Lu})(?=.*\d)(?=.*[^\w\s]).{12,64}$/u,
|
||||
};
|
||||
|
||||
const emailRestrictions: { regex: RegExp } = {
|
||||
regex: /^[^\s#]+#[^\s#]+\.[^\s#]+$/,
|
||||
};
|
||||
|
||||
export {
|
||||
nameRestrictions,
|
||||
displayNameRestrictions,
|
||||
forbiddenDisplayNamePatterns,
|
||||
passwordRestrictions,
|
||||
emailRestrictions,
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue