application/controllers/admin/Login.php
// Process the reset password form submit
Process the reset password form submit
Process the reset password form submit
public function doReset() {
        $email = strtolower($this->input->post('email'));
        $identity = $this->ion_auth->where('email', $email)->users()->row();
        if(empty($identity)) {
            $this->session->set_flashdata('message', "The email address you entered was not found, please try again.");
            redirect("/admin/login/reset");
            exit;
        }
        $this->load->library('message_library');
        $forgot = $this->ion_auth->forgotten_password($identity->{$this->config->item('identity', 'ion_auth')});
        if(!empty($forgot)) {
            $data = array();
            $data['heading'] = "Password Reset - " . $this->config_model->getOption('site_name');
            $forgot['forgotten_password_code'] = urlencode($forgot['forgotten_password_code']);
            $data['reset_password_link'] = site_url("reset_password/{$forgot['forgotten_password_code']}");
            $data['contact_form_url'] = site_url("/contact");
            $message = array();
            $message['to'] = $forgot['identity'];
            $message['subject'] = $data['heading'];
            $message['message'] = $this->template->render($data, true, 'messages/password_reset_email_html.tpl');
            $message['alt_message'] = $this->template->render($data, true, 'messages/password_reset_email_text.tpl');
            $this->message_library->sendEmail($message);
            $this->session->set_flashdata('message_type', 'alert-success');
            $this->session->set_flashdata('message', $this->ion_auth->messages());
            redirect("/login");
        } else {
            $this->session->set_flashdata('message', $this->ion_auth->messages());
            redirect("/admin/login/reset");
        }
    }
public function doReset ( ) { $ email = strtolower ( $ this -> input -> post ( 'email' ) ) ; $ identity = $ this -> ion_auth -> where ( 'email' , $ email ) -> users ( ) -> row ( ) ; if ( empty ( $ identity ) ) { $ this -> session -> set_flashdata ( 'message' , " The email address you entered was not found, please try again. " ) ; redirect ( " /admin/login/reset " ) ; exit ; } $ this -> load -> library ( 'message_library' ) ; $ forgot = $ this -> ion_auth -> forgotten_password ( $ identity -> { $ this -> config -> item ( 'identity' , 'ion_auth' ) } ) ; if ( ! empty ( $ forgot ) ) { $ data = array ( ) ; $ data [ 'heading' ] = " Password Reset -  " . $ this -> config_model -> getOption ( 'site_name' ) ; $ forgot [ 'forgotten_password_code' ] = urlencode ( $ forgot [ 'forgotten_password_code' ] ) ; $ data [ 'reset_password_link' ] = site_url ( " reset_password/ { $ forgot [ 'forgotten_password_code' ] } " ) ; $ data [ 'contact_form_url' ] = site_url ( " /contact " ) ; $ message = array ( ) ; $ message [ 'to' ] = $ forgot [ 'identity' ] ; $ message [ 'subject' ] = $ data [ 'heading' ] ; $ message [ 'message' ] = $ this -> template -> render ( $ data , true , 'messages/password_reset_email_html.tpl' ) ; $ message [ 'alt_message' ] = $ this -> template -> render ( $ data , true , 'messages/password_reset_email_text.tpl' ) ; $ this -> message_library -> sendEmail ( $ message ) ; $ this -> session -> set_flashdata ( 'message_type' , 'alert-success' ) ; $ this -> session -> set_flashdata ( 'message' , $ this -> ion_auth -> messages ( ) ) ; redirect ( " /login " ) ; } else { $ this -> session -> set_flashdata ( 'message' , $ this -> ion_auth -> messages ( ) ) ; redirect ( " /admin/login/reset " ) ; } }
Process the reset password form submit
Process the reset password form submit
// check that this user exists // Process the reset // Configure our template data // Send the email // Set user message and send them back to the login page