From 6d413ffdfc076414baacd26a47f59eef051038da Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 3 Oct 2022 17:03:02 +0300 Subject: [PATCH] Unset the "password" and "salt" parameter when getting a user or a provider --- application/models/Providers_model.php | 6 +++++- application/models/Users_model.php | 14 +++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/application/models/Providers_model.php b/application/models/Providers_model.php index d754f0d493..92305b9241 100755 --- a/application/models/Providers_model.php +++ b/application/models/Providers_model.php @@ -327,7 +327,11 @@ public function find(int $provider_id, bool $with_trashed = FALSE): array $provider['settings'] = $this->db->get_where('user_settings', ['id_users' => $provider_id])->row_array(); - unset($provider['settings']['id_users']); + unset( + $provider['settings']['id_users'], + $provider['settings']['password'], + $provider['settings']['salt'], + ); $service_provider_connections = $this->db->get_where('services_providers', ['id_users' => $provider_id])->result_array(); diff --git a/application/models/Users_model.php b/application/models/Users_model.php index abb8f5a685..33fe525a23 100644 --- a/application/models/Users_model.php +++ b/application/models/Users_model.php @@ -219,7 +219,11 @@ public function find(int $user_id, bool $with_trashed = FALSE): array $user['settings'] = $this->db->get_where('user_settings', ['id_users' => $user_id])->row_array(); - unset($user['settings']['id_users']); + unset( + $user['settings']['id_users'], + $user['settings']['password'], + $user['settings']['salt'], + ); return $user; } @@ -430,6 +434,14 @@ public function search(string $keyword, int $limit = NULL, int $offset = NULL, s foreach ($users as &$user) { $this->cast($user); + + $user['settings'] = $this->db->get_where('user_settings', ['id_users' => $user['id']])->row_array(); + + unset( + $user['settings']['id_users'], + $user['settings']['password'], + $user['settings']['salt'] + ); } return $users;