Question

Copied all ion auth folders into Codeigniter 2.1.4's applications folder. Created all login tables in database. Added following line in index() of default controller:

if ($this->ion_auth->logged_in()) {
            $this->load->view('yovleindex',$data);
        } else {
            $this->load->view('auth/login');
        }

autoload.php

$autoload['libraries'] = array('database','session','input','ion_auth');
$autoload['helper'] = array('url','form','html','language');

When I hit the index page, getting following error.

Then I changed my controller to this but no luck. I got rid of message error but identity and password error is still there.

$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');

if ($this->ion_auth->logged_in()) {
            $this->load->view('yovleindex',$data);
        } else {
            $this->load->view('auth/login',$this->data);
        }
Was it helpful?

Solution

Himanshu,

I can't tell completely what you are doing, but:

" Added following line in index() of default controller"

Does "default controller" mean your own controller? If that is the case, then you are not loading the variables you need - see controllers/auth lines: 86 -100

Your mistake is, if the user is not logged in, you should REDIRECT them to auth/login and let that function load the view, not load the view yourself

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top