From 17b258e3cc57e5470d5328f61bda1ba8f58d9f96 Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 31 Mar 2021 10:56:39 +0800 Subject: [PATCH] fix: password was hashed twice --- packages/database/src/fields/field-types.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/database/src/fields/field-types.ts b/packages/database/src/fields/field-types.ts index c0114bd4b..3583292e3 100644 --- a/packages/database/src/fields/field-types.ts +++ b/packages/database/src/fields/field-types.ts @@ -310,6 +310,9 @@ export class PASSWORD extends STRING { } const value = model.get(name) as string; if (value) { + if (value.startsWith('$2b$10$') && value.length === 60) { + return; + } const hash = await bcrypt.hash(value, 10); model.set(name, hash); } else {