formatting

This commit is contained in:
proddy
2024-04-21 15:10:22 +02:00
parent befa487482
commit ac39a46442
100 changed files with 2778 additions and 798 deletions

View File

@@ -5,12 +5,21 @@ import type { UserType } from 'types';
export const SECURITY_SETTINGS_VALIDATOR = new Schema({
jwt_secret: [
{ required: true, message: 'JWT secret is required' },
{ type: 'string', min: 1, max: 64, message: 'JWT secret must be between 1 and 64 characters' }
{
type: 'string',
min: 1,
max: 64,
message: 'JWT secret must be between 1 and 64 characters'
}
]
});
export const createUniqueUsernameValidator = (users: UserType[]) => ({
validator(rule: InternalRuleItem, username: string, callback: (error?: string) => void) {
validator(
rule: InternalRuleItem,
username: string,
callback: (error?: string) => void
) {
if (username && users.find((u) => u.username === username)) {
callback('Username already in use');
} else {
@@ -32,6 +41,11 @@ export const createUserValidator = (users: UserType[], creating: boolean) =>
],
password: [
{ required: true, message: 'Please provide a password' },
{ type: 'string', min: 1, max: 64, message: 'Password must be 1-64 characters' }
{
type: 'string',
min: 1,
max: 64,
message: 'Password must be 1-64 characters'
}
]
});