Added some fixes to reset pass feature

This commit is contained in:
Arturo Gonzalez 2017-07-19 11:37:17 +02:00
parent 97cfe0260a
commit 278330e8f6
3 changed files with 28 additions and 1 deletions

View File

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

View File

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

View File

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