mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Update backend/src/graphql/resolver/util/validateAlias.ts
Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
This commit is contained in:
parent
c78691c87c
commit
dbe752563b
@ -21,7 +21,7 @@ const reservedAlias = [
|
|||||||
'var',
|
'var',
|
||||||
]
|
]
|
||||||
|
|
||||||
export const validateAlias = async (alias: string): Promise<void> => {
|
export const validateAlias = async (alias: string): Promise<boolean> => {
|
||||||
if (alias.length < 3) throw new LogError('Given alias is too short', alias)
|
if (alias.length < 3) throw new LogError('Given alias is too short', alias)
|
||||||
if (alias.length > 20) throw new LogError('Given alias is too long', alias)
|
if (alias.length > 20) throw new LogError('Given alias is too long', alias)
|
||||||
/* eslint-disable-next-line security/detect-unsafe-regex */
|
/* eslint-disable-next-line security/detect-unsafe-regex */
|
||||||
@ -34,4 +34,5 @@ export const validateAlias = async (alias: string): Promise<void> => {
|
|||||||
if (aliasInUse.length !== 0) {
|
if (aliasInUse.length !== 0) {
|
||||||
throw new LogError('Alias already in use', alias)
|
throw new LogError('Alias already in use', alias)
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user