diff --git a/jobs/controllers/Portal.php b/jobs/controllers/Portal.php
index d79bdd5..5487a9b 100644
--- a/jobs/controllers/Portal.php
+++ b/jobs/controllers/Portal.php
@@ -150,24 +150,26 @@ class Portal {
public function addUserSubmit() {
if ($_SESSION['userType'] == 'admin') {
- $record = [
- 'username' => $_POST['username'],
- 'password' => password_hash($_POST['password'], PASSWORD_DEFAULT),
- 'userType' => $_POST['type']
- ];
- if ($_POST['submit'] == 'Update') {
- $record['id'] = $_POST['user_id'];
- $this->vars['response'] = 'User Updated Successfully';
+ if($_POST['password'] != "") {
+ $record = [
+ 'username' => $_POST['username'],
+ 'password' => password_hash($_POST['password'], PASSWORD_DEFAULT),
+ 'userType' => $_POST['type']
+ ];
+ if ($_POST['submit'] == 'Update') {
+ $record['id'] = $_POST['user_id'];
+ $this->vars['response'] = 'User Updated Successfully';
+ }
+ else {
+ $this->vars['response'] = 'User Created Successfully';
+ }
+ $this->usersTable->save($record);
+ return [
+ 'template' => 'response.html.php',
+ 'title' => 'Jo\'s Jobs- Edit user',
+ 'vars' => $this->vars
+ ];
}
- else {
- $this->vars['response'] = 'User Created Successfully';
- }
- $this->usersTable->save($record);
- return [
- 'template' => 'response.html.php',
- 'title' => 'Jo\'s Jobs- Edit user',
- 'vars' => $this->vars
- ];
}
}
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 0000000..57f38a9
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,8 @@
+
+
+
+
+ tests
+
+
+
\ No newline at end of file
diff --git a/templates/job_add.html.php b/templates/job_add.html.php
index 9554433..80b9ec6 100644
--- a/templates/job_add.html.php
+++ b/templates/job_add.html.php
@@ -1,12 +1,7 @@