当有人点击忘记密码时,我现在正在调用此功能。
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');
}
}
我的问题是令牌已过期,因为为用户生成了一个新令牌。每次进行普通的www调用时都会生成一个新令牌。我需要一种方法来更改逻辑并保存我将通过电子邮件发送给用户的令牌以及用户的ID和令牌的到期时间戳,以及到期时间戳我不知道如何添加再多15分钟。