From cfc6167d4facc0d4f386c3277bfcf5d18a03edcc Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Wed, 23 Sep 2020 14:37:09 +0300 Subject: [PATCH] Use the "alnum" method when generating random strings via the codeigniter helper function (generates shorter strings) --- application/controllers/Installation.php | 2 +- application/models/User_model.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/controllers/Installation.php b/application/controllers/Installation.php index 18dffb83..5c3eb8fe 100644 --- a/application/controllers/Installation.php +++ b/application/controllers/Installation.php @@ -143,7 +143,7 @@ class Installation extends CI_Controller { $services['id'] = $this->services_model->add($services); $salt = generate_salt(); - $password = random_string('sha1', 12); + $password = random_string('alnum', 12); $sample_provider = [ 'first_name' => 'John', diff --git a/application/models/User_model.php b/application/models/User_model.php index 376a8c90..417734aa 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -186,7 +186,7 @@ class User_Model extends CI_Model { $user_id = $result->row()->id; // Create a new password and send it with an email to the given email address. - $new_password = random_string('sha1', 12); + $new_password = random_string('alnum', 12); $salt = $this->db->get_where('user_settings', ['id_users' => $user_id])->row()->salt; $hash_password = hash_password($salt, $new_password); $this->db->update('user_settings', ['password' => $hash_password], ['id_users' => $user_id]);