From abce89355d035c6d2c82805d52b3ff018fac1e74 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Tue, 5 Dec 2017 12:56:50 +0100 Subject: [PATCH] Insert password changes by recover mail in system audit log - #1329 --- pandora_console/godmode/users/configure_user.php | 6 +++--- pandora_console/index.php | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index cdd4157fca..0c88e1e695 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -236,8 +236,6 @@ if ($create_user) { case "postgresql": $result = create_user($id, $password_new, $values); if ($result) { - db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change', - 'descripcion' => 'Access password updated','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time())); $res = save_pass_history($id, $password_new); } break; @@ -349,7 +347,7 @@ if ($update_user) { $res2 = update_user_password ($id, $password_new); if ($res2) { $res3 = save_pass_history($id, $password_new); - db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change', + db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change', 'descripcion' => 'Access password updated','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time())); } ui_print_result_message ($res1 || $res2, @@ -358,6 +356,8 @@ if ($update_user) { } } else { + db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change', + 'descripcion' => 'Access password update failed','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time())); ui_print_error_message (__('Passwords does not match')); } } diff --git a/pandora_console/index.php b/pandora_console/index.php index 683490f646..a60adf1f8e 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -583,6 +583,10 @@ if (! isset ($config['id_user'])) { if ($pass1 == $pass2) { $res = update_user_password ($id_user, $pass1); if ($res) { + + db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id_user,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Reset change', + 'descripcion' => 'Successful reset password process ','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time())); + $correct_reset_pass_process = __('Password changed successfully'); register_pass_change_try($id_user, 1); @@ -675,6 +679,7 @@ if (! isset ($config['id_user'])) { } } else { + $cod_hash = $user_reset_pass . "::::" . md5(rand(10, 1000000) . rand(10, 1000000) . rand(10, 1000000)); $subject = '[Pandora] '.__('Reset password');