Change order of check in global hook

First, check if the requested controller is public.
If it is, we do not care if the user is logged in, so don't
even make the "logged in"-checks at this moment.
This commit is contained in:
Karsten Heiken
2011-12-04 17:16:57 +01:00
parent 9332943c67
commit 030e9fa305

View File

@@ -34,7 +34,7 @@ function check_login() {
$public_controllers = array('auth', 'xmlrpc');
$CI = & get_instance();
if (!$CI->input->is_ajax_request() && !$CI->access->isLoggedIn() && !in_array($CI->router->class, $public_controllers)) {
if (!in_array($CI->router->class, $public_controllers) && !$CI->input->is_ajax_request() && !$CI->access->isLoggedIn()) {
redirect('auth/login');
}
}