When someone clicks on forget password I am calling this function now.
public function reset_password($token){
$this->load->helper('form');
$this->load->library('form_validation');
$this->form_validation->set_rules('email', 'Email', 'required|min_length[5]|max_length[100]|valid_email|xxs_clean');
//if email is not right through them back
if ($this->form_validation->run() == FALSE) {
$this->load->view('header');
$this->load->view('forgot_password_view');
$this->load->view('footer');
}else{
$email = $this->input->post('email');
// Verify the username is not in use already.
$userid = $this->myajax->getUserByAuth($token);
$result = $this->user_profile->IsUsernameInUse($email, $userid);
$data = array(
'userid' => $userid,
'token' => $token,
'expiration' => date('Y-m-d')
);
$this->db->insert('reset_password', $data);
//$this->send_reset_password_email($email, $result);
$this->load->view('header');
$this->load->view('reset_password_sent_view', array('email'=> $email));
$this->load->view('footer');
}
}
My problem is that the token is expired, because a new token is generated for the user. A new token is generated every time an ordinary www call is made. I need a way to change logic and save the token that I will send the user via email in a new support table alongside with the user's ID and the expiration time stamp for the token, and the expiration time stamp I am not sure how to add 15 minutes more.