插入一个功能忘记密码点火器


insert a function forgot password Codeigniter

我需要帮助在以下站点中插入链接描述,在此处输入代码点火器中忘记的功能。我尝试自己,但找不到页面。表单 html:

<div class="callout-copy">
  <h1>Welcome To Kea Talks.</h1>
  <p>Kea talks helps you to connect and share with the people in your Kea life.</p>
  <img class="logo" src="<?php echo base_url();?>assets/css/images/logo1.png" alt="logo">
</div>
</div>
<div class="front-signin js-front-signin">
<form action="<?php echo base_url();?>index.php/user/signin" class="signin" method="post"  id="signin">
<div class="username">
  <input type="text" id="signin-email" required class="text-input email-input" name="email" autocomplete="on" placeholder="Email">
  </div>
 <table class="flex-table password-signin">
  <tbody>
  <tr>
    <td class="flex-table-primary">
      <div class="password flex-table-form">
        <input type="password" id="signin-password" required class="text-input flex-table-input" name="password" placeholder="Password">
      </div>
    </td>
    <td class="flex-table-secondary">
      <button type="submit" class="submit btn primary-btn flex-table-btn js-submit">
        Sign in
      </button>
    </td>
    </tr>
    </tbody>
    </table>
    <div class="remember-forgot">
    <span class="separator">·</span>
    <a class="forgot" href="<?php echo base_url();?>index.php/user/resend_password.php">Forgot  password?</a>
    </div>
    </form>

模型中的功能:

class user_model extends CI_Model{
function __construct(){
    parent::__construct();
}
function validate($email , $password){
    $this->db->where('email',$email);
    $this->db->where('password',$password);
    $query=$this->db->get('user');
    if($query->num_rows==1){
        $row = $query->row();
        $data = array(
                'userid' => $row->userid,
                'fullname'=> $row->fullname,
                'profilepic'=> $row->profilepic,
                'validated' => true
                );
        $this->session->set_userdata($data);


        return "1";
    }
    return "0";

}

控制器:

class user extends CI_Controller{
    function __construct(){
    parent::__construct();
    $this->load->helper('url');
}
public function index(){
if(!$this->session->userdata('userid')){    
$this->load->view('user/login');
$this->load->view('header');
} 
else{
redirect('index.php/user/profile','refresh');
 }
 }

2sd 部分:

public function login(){
$name=$this->security->xss_clean($this->input->post('username'));
$pass=$this->security->xss_clean($this->input->post('password'));
$this->load->model('user_model');
$status=$this->user_model->validate($name,$pass);
    echo $status;
    }
    function logout(){

$this->session->sess_destroy();
    redirect('index.php/user','refresh');
      }
首先将

你的锚点替换为忘记密码:

<a class="forgot" href="<?php echo base_url();?>index.php/user/resend_password">Forgot  password?</a>   

然后在用户类中定义一个名称为resend_password的函数:

 public function resend_password(){
   #your code here..
 }
<a class="forgot" href="<?php echo site_url('user/resend_password/')?>Forgot  password?</a>

并在控制器用户中编写函数resend_password