Fix database init script + employee creation (#822)

This commit is contained in:
jekkos
2016-09-01 20:00:49 +02:00
parent eb59079fe5
commit 71e54d90bf
4 changed files with 12 additions and 11 deletions

View File

@@ -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

View File

@@ -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);
-- --------------------------------------------------------

View File

@@ -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);
-- --------------------------------------------------------

View File

@@ -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);
-- --------------------------------------------------------