Welcome Guest, Not a member yet? Register   Sign In
Best way to handle authentication with MY_Controller ?
#4

[eluser]jedd[/eluser]
I put my checks in each controller's constructor, viz:

Code:
$this->_ensure_authenticated_user( "Forum" );

_ensure_authenticated_user() is a function in MY_Controller, of course. If you need to be logged in (authenticated) then it never comes back, and instead redirects to the login page.

On controllers where some methods are public and some are not - and at the moment only people/login & people/logout are such exceptions - I have the above code wrapped in a conditional that tests the subsequent url segment. Obviously for publicly visible controllers, I simply do not include that code at all.


Messages In This Thread
Best way to handle authentication with MY_Controller ? - by El Forum - 09-18-2009, 11:11 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-18-2009, 06:40 PM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 05:10 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 05:39 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 05:43 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 09:03 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 09:28 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 11:33 AM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 08:00 PM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 09:47 PM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-19-2009, 11:46 PM
Best way to handle authentication with MY_Controller ? - by El Forum - 09-20-2009, 05:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB