Skip to content

Commit

Permalink
Unset the "password" and "salt" parameter when getting a user or a pr…
Browse files Browse the repository at this point in the history
…ovider
  • Loading branch information
alextselegidis committed Oct 3, 2022
1 parent a01acc5 commit 6d413ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 5 additions & 1 deletion application/models/Providers_model.php
Expand Up @@ -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();

Expand Down
14 changes: 13 additions & 1 deletion application/models/Users_model.php
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6d413ff

Please sign in to comment.