From 278330e8f6cee8c59acde1e8d52c325f81f84bc9 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 19 Jul 2017 11:37:17 +0200 Subject: [PATCH] Added some fixes to reset pass feature --- .../extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 10 ++++++++++ pandora_console/index.php | 9 ++++++++- pandora_console/pandoradb.sql | 10 ++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 16b67d8e28..b216b01d3c 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1337,6 +1337,16 @@ CREATE TABLE IF NOT EXISTS `tcontainer` ( INSERT INTO `tcontainer` SET `name` = 'Default graph container'; +-- ---------------------------------------------------------------------- +-- Table `treset_pass_history` +-- ---------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `treset_pass_history` ( + `id` int(10) unsigned NOT NULL auto_increment, + `id_user` varchar(60) NOT NULL, + `reset_moment` date default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- --------------------------------------------------------------------- -- Table `tcontainer_item` -- --------------------------------------------------------------------- diff --git a/pandora_console/index.php b/pandora_console/index.php index ff0e86cb8c..5a32eaa670 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -584,6 +584,13 @@ if (! isset ($config['id_user'])) { $res = update_user_password ($id_user, $pass1); if ($res) { $correct_reset_pass_process = __('Password changed successfully'); + + $values = array(); + $values['id_user'] = $id_user; + $reset_pass_moment = new DateTime('now'); + $reset_pass_moment = $reset_pass_moment->format("Y-m-d H:i:s"); + $values['reset_moment'] = $reset_pass_moment; + db_process_sql_insert('treset_pass_history', $values); } else { $process_error_message = __('Failed to change password'); @@ -641,7 +648,7 @@ if (! isset ($config['id_user'])) { if (!$check_user) { $reset = false; - $error = __('User doesn\'t exist in database'); + $error = __('Error in reset password request'); $show_error = true; } else { diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 9733792280..91362e2d59 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1143,6 +1143,16 @@ CREATE TABLE IF NOT EXISTS `tuser_double_auth` ( FOREIGN KEY (`id_user`) REFERENCES tusuario(`id_user`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ---------------------------------------------------------------------- +-- Table `treset_pass_history` +-- ---------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `treset_pass_history` ( + `id` int(10) unsigned NOT NULL auto_increment, + `id_user` varchar(60) NOT NULL, + `reset_moment` datetime not null default 0, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- ---------------------------------------------------------------------- -- Table `tnews` -- ----------------------------------------------------------------------