benedmunds/CodeIgniter-Ion-Auth — pull request #304 by thanasisem (2012-09-17 05:35:43+00:00)
Title: Patch 1

Hi

I have changed some of the code in the controllers/auth.php.
Specifically, I fixed the create_user() function and made 2 changes.

1. There was a weird conditional check in the start of create_user() method that was going like this:

if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
{
redirect('auth', 'refresh');
}

Which actually says: if user is not logged in OR is not admin redirect him to auth (auth/index).

No need for this kind of check. create_user() runs every time a guest wants to register himself into the system, so it is normal that he will NOT be logged in and will NOT be an admin either. For this reason, this check is useless and breaks the program flow so I removed it.

2. After the user is successfully registered into the system, the controller redirects him to auth (auth/index).

//check to see if we are creating the user
//redirect them back to the admin page
$this->session->set_flashdata('message', $this->ion_auth->messages());
redirect("auth", 'refresh');

If the user is redirect to auth, he will be redirected to auth/login which is the correct place we want him to go BUT there will be no informational message about his registration, e.g. success message.

Solution: To fix this I changed the redirect to auth/login.

Please let me know if I'm missing something.
This is my first commit on github and in the open source community.
Thanks again for a nice script.

Best Regards,
Thanasis Emmanouilidis