[eluser]xatrix[/eluser]
Once the user is logged in, here's how to redirect him to the page that required auth.
In Ion_Auth.php
Code:
public function logged_in()
{
$this->ci->session->set_flashdata('referrer', current_url());
$identity = $this->ci->config->item('identity', 'ion_auth');
if ($this->ion_auth->login($this->input->post('email'), $this->input->post('password'), $remember))
{ //if the login is successful
//redirect them from whence they came
$this->session->set_flashdata('message', $this->ion_auth->messages());
redirect($this->session->flashdata('referrer'));
}
}
Basically it will only set flashdata when it has to check if the user is logged in, and redirect when he is.
Also in your Auth.php, loading a view counts as a server request. So before you load the login view, tell CI to keep the data:
* however, I'm not sure what happens if you call logged_in multiple times. There must be some way to check that flashdata has been set, so that the same key isn't overwritten (is that even possible?) and reduce code crap. Any ideas?