2014-02-18 104 views
0

在表單驗證中,當前密碼必須與我登錄的密碼匹配。如果我引入的當前密碼與我用於登錄的密碼匹配,則可以更改我的密碼。但它不起作用,我可以在我當前的密碼字段中輸入任何密碼。我的問題是如何把匹配功能用於登錄的密碼。(我用來登錄的密碼存儲在會話中)。匹配函數參數codeigniter

function edit_info() 

{ 
    $this->load->helper(array('form', 'url')); 
    $this->load->library('session'); 
    $this->load->library('form_validation'); 
    $this->form_validation->set_rules('firstname2','FirstName','trim|required'); 
    $this->form_validation->set_rules('lastname2','LastName','trim|required'); 
    $this->form_validation->set_rules('current_password','Current Password','trim|required|matches(password)'); 
    $this->form_validation->set_rules('password3','Password','trim|required|min_length[4]|max_length[32]'); 

    if($this->form_validation->run() == FALSE) 
    { 
     $this->edit(); 
    } 
    else 
    { 

     $this->load->model('membership_model'); 
     if($this->membership_model->edit_member()) 
     { 
      $data['main_content']='edit_successful'; 
      $this->load->view('includes/template',$data); 
     } 
     else 
     { 
      $this->load->view('main_menu'); 
     } 
    } 
} 

回答