diff --git a/application/controllers/Employees.php b/application/controllers/Employees.php index 3d98222c3..2fb679099 100644 --- a/application/controllers/Employees.php +++ b/application/controllers/Employees.php @@ -104,7 +104,7 @@ class Employees extends Persons 'state' => $this->input->post('state'), 'zip' => $this->input->post('zip'), 'country' => $this->input->post('country'), - 'comments' => $this->input->post('comments') + 'comments' => $this->input->post('comments'), ); $grants_data = $this->input->post('grants') != NULL ? $this->input->post('grants') : array(); @@ -113,7 +113,8 @@ class Employees extends Persons { $employee_data = array( 'username' => $this->input->post('username'), - 'password' => md5($this->input->post('password')) + 'password' => password_hash($this->input->post('password')), + 'hash_version' => 2 ); } else //Password not changed diff --git a/database/database.sql b/database/database.sql index 665e78017..e06589773 100644 --- a/database/database.sql +++ b/database/database.sql @@ -115,7 +115,7 @@ CREATE TABLE `ospos_employees` ( `password` varchar(255) NOT NULL, `person_id` int(10) NOT NULL, `deleted` int(1) NOT NULL DEFAULT '0', - `hash_version` int(1) NOT NULL DEFAULT '2' + `hash_version` int(1) NOT NULL DEFAULT '2', UNIQUE KEY `username` (`username`), KEY `person_id` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -124,8 +124,8 @@ CREATE TABLE `ospos_employees` ( -- Dumping data for table `ospos_employees` -- -INSERT INTO `ospos_employees` (`username`, `password`, `person_id`, `deleted`) VALUES -('admin', '439a6de57d475c1a0ba9bcb1c39f0af6', 1, 0); +INSERT INTO `ospos_employees` (`username`, `password`, `person_id`, `deleted`, `hash_version`) VALUES +('admin', '439a6de57d475c1a0ba9bcb1c39f0af6', 1, 0, 1); -- -------------------------------------------------------- diff --git a/database/migrate_phppos_dist.sql b/database/migrate_phppos_dist.sql index aff65557b..944c34577 100644 --- a/database/migrate_phppos_dist.sql +++ b/database/migrate_phppos_dist.sql @@ -115,7 +115,7 @@ CREATE TABLE `ospos_employees` ( `password` varchar(255) NOT NULL, `person_id` int(10) NOT NULL, `deleted` int(1) NOT NULL DEFAULT '0', - `hash_version` int(1) NOT NULL DEFAULT '2' + `hash_version` int(1) NOT NULL DEFAULT '2', UNIQUE KEY `username` (`username`), KEY `person_id` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -124,8 +124,8 @@ CREATE TABLE `ospos_employees` ( -- Dumping data for table `ospos_employees` -- -INSERT INTO `ospos_employees` (`username`, `password`, `person_id`, `deleted`) VALUES -('admin', '439a6de57d475c1a0ba9bcb1c39f0af6', 1, 0); +INSERT INTO `ospos_employees` (`username`, `password`, `person_id`, `deleted`, `hash_version`) VALUES +('admin', '439a6de57d475c1a0ba9bcb1c39f0af6', 1, 0, 1); -- -------------------------------------------------------- diff --git a/database/tables.sql b/database/tables.sql index 2335b5a25..ffb4a0a33 100644 --- a/database/tables.sql +++ b/database/tables.sql @@ -115,7 +115,7 @@ CREATE TABLE `ospos_employees` ( `password` varchar(255) NOT NULL, `person_id` int(10) NOT NULL, `deleted` int(1) NOT NULL DEFAULT '0', - `hash_version` int(1) NOT NULL DEFAULT '2' + `hash_version` int(1) NOT NULL DEFAULT '2', UNIQUE KEY `username` (`username`), KEY `person_id` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -124,8 +124,8 @@ CREATE TABLE `ospos_employees` ( -- Dumping data for table `ospos_employees` -- -INSERT INTO `ospos_employees` (`username`, `password`, `person_id`, `deleted`) VALUES -('admin', '439a6de57d475c1a0ba9bcb1c39f0af6', 1, 0); +INSERT INTO `ospos_employees` (`username`, `password`, `person_id`, `deleted`, `hash_version`) VALUES +('admin', '439a6de57d475c1a0ba9bcb1c39f0af6', 1, 0, 1); -- --------------------------------------------------------