add more responsiveness when updating self admin
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user