내 컨트롤러codeigniter를 사용하여 한 함수에서 다른 함수로 다른 함수를 호출하는 방법은 무엇입니까?
public function forgot_password(){
$email = $this->input->post('email_recover');
$token = bin2hex(openssl_random_pseudo_bytes(32));
$findemail = $this->user_model->forgot_password($email);
if ($findemail) {
$config['protocol'] = "smtp";
$config['smtp_host'] = "ssl://smtp.gmail.com";
$config['smtp_port'] = "465";
$config['smtp_user'] = "[email protected]";
$config['smtp_pass'] = "password";
$config['charset'] = "utf-8";
$config['mailtype'] = "html";
$config['newline'] = "\r\n";
$this->email->initialize($config);
$this->email->from('[email protected]', 'Admin');
$this->email->to(set_value('email_recover'));
$this->email->subject('Reset password');
$email = $this->input->post('email');
$this->email->message('<h3>Dear user.</h3><br><br><p>We want to help you to reset your password.</p>. <p>Here is the reset link '. base_url() .'login/reset_password/'.$token.'</p>');
if(!$this->email->send()){
$this->session->set_flashdata('error', 'There is some error with your email. Please try again');
}
else{
$this->session->set_flashdata('success', 'Please check your email.');
}
} else {
redirect('login');
}
}
public function reset_password(){
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('confirmpassword', 'Confirm Password', 'required');
if($this->form_validation->run() === FALSE){
$this->load->view('templates/pheader');
$this->load->view('register/reset_password');
$this->load->view('templates/pfooter');
} else {
$this->user_model->reset_password();
//redirect('login/reset_password ');
}
}
내 모델
public function reset_password(){
$data = array('password' => $this->input->post('password'));
$this->db->where('email',$email);
return $this->db->update('login_user', $data);
}
나를 여기 도와주세요. 사용자에게 복구 이메일 링크를 보내고 싶습니다. 올바르게 작동하고 있습니다. 이제 사용자가 비밀번호 재설정 페이지의 입력란을 채울 때 해당 사용자의 이메일 ID를 확인할 수 없습니다. 다른 사람이 다른 양식으로 입력 된 이메일에 액세스하는 방법을 말해 줄 수 있습니까?
두 번째 양식에 숨겨진 필드로 넣거나 다른 방법으로 저장해야합니다 (예 : 세션에서 일시적으로). HTTP 요청은 상태 비 저장됩니다. 명시 적으로 그렇게하지 않는 한 데이터는 그 사이에 유지되지 않습니다. – ADyson
자신의 암호화 된 이메일 ID 및 시간 제한 링크를 활성 상태로 보낼 수 있습니다. 그가 링크를 열면 자격 증명이 DB와 일치합니다. – GYaN
어떻게 숨겨진 입력 필드로 전자 메일을 전달할 수 있습니까? @ADyson –