MSP-3427 added audit for password change

This commit is contained in:
Tim committed 2024-06-19 12:37:43 +03:00
1 parent 6f48eea3c9
commit e7935499b6
3 files changed
+11 -8

No files matched your search

+2 -1
View File
@@ -469,6 +469,7 @@ func (u User) ChangePassword(ctx context.Context, adminId int64, oldPassword str
}
if err := bcrypt.CompareHashAndPassword([]byte(admin.Password), []byte(oldPassword)); err != nil {
u.auditService.SaveAuditAsync(ctx, adminId, "Указан неверный старый пароль", entity.EventErrorPasswordChange)
return domain.ErrInvalidPassword
}
@@ -487,7 +488,7 @@ func (u User) ChangePassword(ctx context.Context, adminId int64, oldPassword str
return errors.WithMessage(err, "revoke all tokens by user id")
}
u.auditService.SaveAuditAsync(ctx, adminId, "Выход", entity.EventSuccessLogout)
u.auditService.SaveAuditAsync(ctx, adminId, "Сменил пароль", entity.EventUserPasswordChanged)
return nil
}