public function reset_pass($token = null) { if (empty($token)) { redirect('forgot_pass'); } else { if (User::count(array('conditions' => array('pass_key = ?', $token))) == 0) { redirect('forgot_pass'); } } $this->data['token'] = $token; $this->data['user'] = User::find_by_pass_key($token); if ($_POST) { if ($this->form_validation->run('pass_reset') == FALSE) { $this->content_view = 'forgot_pass/reset_pass'; $this->data['error'] = true; } else { $this->data['user']->password = crypt($this->input->post('pass') . $this->data['user']->salt); $this->data['user']->pass_key = ""; $this->data['user']->save(); $this->content_view = 'forgot_pass/reset_pass_confirm'; } } else { $this->content_view = "forgot_pass/reset_pass"; } }