From 55e6460b0e1e6a28376d1594709a49fffbf01486 Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 25 May 2022 11:49:09 +0800 Subject: [PATCH] fix(database): cannot read properties of null (reading 'substring') --- packages/core/database/src/fields/password-field.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/core/database/src/fields/password-field.ts b/packages/core/database/src/fields/password-field.ts index 88c34c04b8..dfd6e2d21c 100644 --- a/packages/core/database/src/fields/password-field.ts +++ b/packages/core/database/src/fields/password-field.ts @@ -20,6 +20,8 @@ export class PasswordField extends Field { } async verify(password: string, hash: string) { + password = password || ''; + hash = hash || ''; const { length = 64, randomBytesSize = 8 } = this.options; return new Promise((resolve, reject) => { const salt = hash.substring(0, randomBytesSize * 2);