2017-10-17 2 views
0
public function change_password() 
{ 
if($_POST) 
{ 
    $this->load->library('form_validation'); 
    $this->form_validation->set_rules('old_password', 'Old Password', 'required'); 
    $this->form_validation->set_rules('new_password', 'New Password', 'required|matches[repass]'); 
    $this->form_validation->set_rules('retype_password', 'Repeat Password', 'required'); 
    if (!$this->ion_auth->logged_in()) 
    { 
    redirect(base_url(), 'refresh'); 
    } 
    $user = $this->ion_auth->user()->row(); 

    if ($this->form_validation->run() == TRUE) 
    { 
    $pass=$this->input->post('oldpass'); 
        $npass=$this->input->post('new_password'); 
        $rpass=$this->input->post('retype_password'); 

        $change = $this->ion_auth->change_password($this->session->email, $pass, $npass); 
        if ($change) 
    { 
    //if the password was successfully changed 
    $this->session->set_flashdata('message_success', $this->ion_auth->messages()); 
    $this->logout(); 
    } 
    else 
    { 
    $this->session->set_flashdata('message_error', $this->ion_auth->errors()); 
    redirect('user/profile', 'refresh'); 
    } 

    } 
    else 
    { 
    echo validation_errors();exit; 
    } 
     } 

     //$this->load->model('Profile_m'); 
    //$this->db->update('users',$data,array('id'=>$user_id)); 
    $this->data['subview']='Page/profile'; 
    $this->load->view('__layout_admin',$this->data); 
    } 
+0

aus dem Code „Das neue Passwort-Feld nicht das Repass Feld paßt“ sein ‚retype_password‘, wenn Ihr neues Passwort ist dasselbe wie jedes Passwort in der Datenbank, es wird ein Fehler angezeigt. – geeth

Antwort

0

Diese Linie mispelled ‚Repass‘ sollte

$this->form_validation->set_rules('new_password', 'New Password', 'required|matches[retype_password]'); 
+0

gerade jetzt zeigt es nicht Fehler bt Passwort nicht ändern .. –

Verwandte Themen