add more responsiveness when updating self admin

This commit is contained in:
2023-08-28 18:46:41 +02:00
parent 90cb1fea87
commit 6d4ad29379
5 changed files with 51 additions and 29 deletions

View File

@@ -55,7 +55,7 @@ export class Admin extends Model {
@BeforeCreate
@BeforeUpdate
static hashPassword(instance: Admin) {
if (instance.password != null) {
if ((instance.changed() || []).indexOf('password') != -1) {
instance.password = bcrypt.hashSync(instance.password, 10);
}
}