mercredi 1 juin 2016

Login taking very long and stuck in pending status before it finally loads

I created a website based on the CodeIgniter framework and using a plugin called ion_auth to authenticate and log in the user: http://ift.tt/KQPQhW. The login takes over 30 seconds to complete and is stuck in pending status in the network tab of chrome inspector. I am not sure what is causing this or the best way to debug it.

Login Request Header

enter image description here

    // log the user in
    function login()
    {
        $this->data['title'] = "Login";

        //validate form input
        $this->form_validation->set_rules(
            'identity',
            'Identity',
            'required'
        );
        $this->form_validation->set_rules(
            'password',
            'Password',
            'required'
        );

        if ($this->form_validation->run() == true)
        {
            // check to see if the user is logging in
            // check for "remember me"
            $remember = (bool)$this->input->post('remember');

            if ($this->ion_auth->login(
                $this->input->post('identity'),
                $this->input->post('password'),
                $remember
            )
            )
            {
                //if the login is successful
                //redirect them back to the home page
                $this->session->set_flashdata(
                    'message',
                    $this->ion_auth->messages()
                );
                redirect('/', 'refresh');
            }
            else
            {
                // if the login was un-successful
                // redirect them back to the login page
                $this->session->set_flashdata(
                    'message',
                    $this->ion_auth->errors()
                );
                redirect(
                    'auth/login',
                    'refresh'
                ); // use redirects instead of loading views for compatibility with MY_Controller libraries
            }
        }
        else
        {
            // the user is not logging in so display the login page
            // set the flash data error message if there is one
            $this->data['message'] =
                (validation_errors()) ? validation_errors() :
                    $this->session->flashdata('message');

            $this->data['identity'] = array(
                'name'        => 'identity',
                'id'          => 'identity',
                'type'        => 'text',
                'placeholder' => 'email',
                'value'       => $this->form_validation->set_value(
                    'identity'
                ),
            );
            $this->data['password'] = array(
                'name'        => 'password',
                'id'          => 'password',
                'type'        => 'password',
                'placeholder' => 'password',
            );
            $this->load->model('Content_model');
            $categories = $this->Content_model->get_categories();
            $notification = $this->Content_model->count_user_notification();
            $this->data['notification'] = $notification;
            $this->data['categories'] = $categories;
            $this->_render_page('auth/login', $this->data);
        }
    }

Response: enter image description here




Aucun commentaire:

Enregistrer un commentaire