forked from FoundKeyGang/FoundKey
Fix bug
This commit is contained in:
parent
bc06c66407
commit
2b02655a3f
2 changed files with 2 additions and 2 deletions
|
@ -100,7 +100,7 @@ export function validatePassword(password: string): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isValidName(name: string): boolean {
|
export function isValidName(name: string): boolean {
|
||||||
return typeof name == 'string' && name.length < 30 && name.trim() != '';
|
return name === null || (typeof name == 'string' && name.length < 30 && name.trim() != '');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isValidDescription(description: string): boolean {
|
export function isValidDescription(description: string): boolean {
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default async (value, verifier?: string) => {
|
||||||
object.type !== 'Person' ||
|
object.type !== 'Person' ||
|
||||||
typeof object.preferredUsername !== 'string' ||
|
typeof object.preferredUsername !== 'string' ||
|
||||||
!validateUsername(object.preferredUsername) ||
|
!validateUsername(object.preferredUsername) ||
|
||||||
(object.name != '' && !isValidName(object.name)) ||
|
!isValidName(object.name == '' ? null : object.name) ||
|
||||||
!isValidDescription(object.summary)
|
!isValidDescription(object.summary)
|
||||||
) {
|
) {
|
||||||
throw new Error('invalid person');
|
throw new Error('invalid person');
|
||||||
|
|
Loading…
Reference in a new issue