/** * forgotten_password_complete * * @return void * @author Mathew **/ public function forgotten_password_complete($code) { $user = User::find_by_forgotten_password_code($code); if (!$user) { return FALSE; } $new_password = User::forgotten_password_complete($code); if ($new_password) { $data = array('identity' => $user->email, 'new_password' => $new_password); $message = $this->ci->load->view($this->ci->config->item('email_templates') . $this->ci->config->item('email_forgot_password_complete'), $data, true); //config to send email $config['protocol'] = $this->ci->config->item('mail_protocol'); if ($config['protocol'] == 'smtp') { $config['smtp_host'] = $this->ci->config->item('mail_host'); $config['smtp_user'] = $this->ci->config->item('admin_email'); $config['smtp_pass'] = $this->ci->config->item('mail_pass'); } $this->ci->email->initialize($config); $this->ci->email->clear(); $this->ci->email->set_newline("\r\n"); $this->ci->email->from($this->ci->config->item('admin_email'), $this->ci->config->item('site_title')); $this->ci->email->to($user->email); $this->ci->email->subject($this->ci->config->item('site_title') . ' - ' . lang('web_auth_np')); $this->ci->email->message($message); if ($this->ci->email->send()) { return $new_password; } else { return FALSE; } } return FALSE; }