Welcome Guest, Not a member yet? Register   Sign In
flexi auth - A user authentication library for CodeIgniter
#54

[eluser]haseydesign[/eluser]
In reply to an email I received from 'Wills', this may also help others with the same problem.

Quote:I use the routes function in codeigniter to make prettier URLS but when I set the logout one to:
$route['logout'] = 'auth/logout';

All it does is goes to the user dashboard, but accessing the URL auth/logout, it logs out nicely. Any ideas?

This is simply a conflict with the way the demo example has been setup, and is not a problem with the library.

In the __construct() of the current 'auth' controller, there is an IF condition that performs a redirect if true.
Code:
if ($this->flexi_auth->is_logged_in_via_password() && uri_string() != 'auth/logout')

Because of the new url routing the uri_string() function would now return 'logout', rather than 'auth/logout', and therefore causing a the __construct() to redirect before the logout method got to be called.

Changing the code to the following would allow for both url paths.
Code:
if ($this->flexi_auth->is_logged_in_via_password() && ! in_array(uri_string(), array('auth/logout', 'logout')))


Messages In This Thread
flexi auth - A user authentication library for CodeIgniter - by El Forum - 10-10-2012, 02:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB