diff --git a/add_user_modal.php b/add_user_modal.php index f0c99f11..d5844277 100644 --- a/add_user_modal.php +++ b/add_user_modal.php @@ -36,7 +36,10 @@
- + +
+ +
diff --git a/edit_user_modal.php b/edit_user_modal.php index 5b217b8d..8a23cf57 100644 --- a/edit_user_modal.php +++ b/edit_user_modal.php @@ -9,7 +9,6 @@
-
- +
- + +
+ +
diff --git a/post.php b/post.php index bd0c55e1..1307e069 100644 --- a/post.php +++ b/post.php @@ -73,12 +73,7 @@ if(isset($_POST['edit_user'])){ $name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']))); $email = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['email']))); $current_password_hash = $_POST['current_password_hash']; - $password = $_POST['password']; - if($current_password_hash == $password){ - $password = $current_password_hash; - }else{ - $password = md5($password); - } + $new_password = $_POST['new_password']; $company = intval($_POST['company']); $level = intval($_POST['level']); $path = strip_tags(mysqli_real_escape_string($mysqli,$_POST['current_avatar_path'])); @@ -95,6 +90,11 @@ if(isset($_POST['edit_user'])){ mysqli_query($mysqli,"UPDATE users SET name = '$name', email = '$email', password = '$password', avatar = '$path', updated_at = NOW() WHERE user_id = $user_id"); + if(!empty($new_password)){ + $new_password = md5($new_password); + mysqli_query($mysqli,"UPDATE users SET password = '$new_password' WHERE user_id = $user_id"); + } + //Create Permissions mysqli_query($mysqli,"UPDATE permissions SET permission_level = $level, permission_default_company = $company WHERE user_id = $user_id"); @@ -112,13 +112,7 @@ if(isset($_POST['edit_profile'])){ $user_id = intval($_POST['user_id']); $name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']))); $email = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['email']))); - $current_password_hash = $_POST['current_password_hash']; - $password = $_POST['password']; - if($current_password_hash == $password){ - $password = $current_password_hash; - }else{ - $password = md5($password); - } + $new_password = $_POST['new_password']; $path = strip_tags(mysqli_real_escape_string($mysqli,$_POST['current_avatar_path'])); if($_FILES['file']['tmp_name']!='') { @@ -131,7 +125,12 @@ if(isset($_POST['edit_profile'])){ move_uploaded_file($_FILES['file']['tmp_name'], $path); } - mysqli_query($mysqli,"UPDATE users SET name = '$name', email = '$email', password = '$password', avatar = '$path', updated_at = NOW() WHERE user_id = $user_id"); + mysqli_query($mysqli,"UPDATE users SET name = '$name', email = '$email', avatar = '$path', updated_at = NOW() WHERE user_id = $user_id"); + + if(!empty($new_password)){ + $new_password = md5($new_password); + mysqli_query($mysqli,"UPDATE users SET password = '$new_password' WHERE user_id = $user_id"); + } //logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'User', log_action = 'Modified', log_description = '$name', log_created_at = NOW()"); diff --git a/settings-general.php b/settings-general.php index 24d8ba85..5acadf15 100644 --- a/settings-general.php +++ b/settings-general.php @@ -13,9 +13,12 @@
- + +
+ +
+
-
@@ -25,7 +28,10 @@
- + +
+ +
This will also update the key on all client logins diff --git a/settings-mail.php b/settings-mail.php index 0e569c3e..1d399822 100644 --- a/settings-mail.php +++ b/settings-mail.php @@ -45,7 +45,10 @@
- + +
+ +
diff --git a/settings-user.php b/settings-user.php index bfce7e16..d3e58a4c 100644 --- a/settings-user.php +++ b/settings-user.php @@ -28,7 +28,6 @@ $password = $row['password']; -
@@ -62,14 +61,18 @@ $password = $row['password'];
- +
- + +
+ +
+
diff --git a/setup.php b/setup.php index 77dc43ff..6166b089 100644 --- a/setup.php +++ b/setup.php @@ -392,7 +392,10 @@ if(isset($_POST['add_company_settings'])){
- + +
+ +
@@ -457,7 +460,10 @@ if(isset($_POST['add_company_settings'])){
- + +
+ +
@@ -652,6 +658,7 @@ if(isset($_POST['add_company_settings'])){ + diff --git a/users.php b/users.php index 0e41a291..64e8c077 100644 --- a/users.php +++ b/users.php @@ -84,7 +84,6 @@ $user_id = $row['user_id']; $name = $row['name']; $email = $row['email']; - $password = $row['password']; $avatar = $row['avatar']; $permission_default_company = $row['permission_default_company']; $permission_level = $row['permission_level'];