mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
update es build
This commit is contained in:
@@ -8,6 +8,16 @@ export const SECURITY_SETTINGS_VALIDATOR = new Schema({
|
||||
]
|
||||
});
|
||||
|
||||
export const createUniqueUsernameValidator = (users: User[]) => ({
|
||||
validator(rule: InternalRuleItem, username: string, callback: (error?: string) => void) {
|
||||
if (username && users.find((u) => u.username === username)) {
|
||||
callback('Username already in use');
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export const createUserValidator = (users: User[], creating: boolean) =>
|
||||
new Schema({
|
||||
username: [
|
||||
@@ -24,13 +34,3 @@ export const createUserValidator = (users: User[], creating: boolean) =>
|
||||
{ type: 'string', min: 1, max: 64, message: 'Password must be 1-64 characters' }
|
||||
]
|
||||
});
|
||||
|
||||
export const createUniqueUsernameValidator = (users: User[]) => ({
|
||||
validator(rule: InternalRuleItem, username: string, callback: (error?: string) => void) {
|
||||
if (username && users.find((u) => u.username === username)) {
|
||||
callback('Username already in use');
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user