fix(database): cannot read properties of null (reading 'substring')

This commit is contained in:
chenos 2022-05-25 11:49:09 +08:00
parent aae11b6e1f
commit 55e6460b0e

View File

@ -20,6 +20,8 @@ export class PasswordField extends Field {
} }
async verify(password: string, hash: string) { async verify(password: string, hash: string) {
password = password || '';
hash = hash || '';
const { length = 64, randomBytesSize = 8 } = this.options; const { length = 64, randomBytesSize = 8 } = this.options;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const salt = hash.substring(0, randomBytesSize * 2); const salt = hash.substring(0, randomBytesSize * 2);