fix: password was hashed twice

This commit is contained in:
chenos 2021-03-31 10:56:39 +08:00
parent b761bf876e
commit 17b258e3cc

View File

@ -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 {