[Solar-talk] Verifying Login Status
Sean Montague
scene at themountainscene.com
Thu Feb 7 09:30:41 CST 2008
Just as a follow up, I modified my Vendor_App_Base to look like this:
function _setup() {
// Register a Solar_Sql object if not already
if (! Solar_Registry::exists('sql')) {
Solar_Registry::set('sql', Solar::factory('Solar_Sql'));
}
// Register a Solar_User object if not already.
// This will trigger the authentication process.
if (! Solar_Registry::exists('user')) {
Solar_Registry::set('user', Solar::factory('Solar_User'));
}
$auth = Solar::factory('Solar_Auth');
$auth->start();
Solar_Registry::set('auth', $auth);
if (Solar_Registry::get('auth')->isValid()) {
// user is logged in
} else {
// user is *not* logged in
$uri = Solar::factory('Solar_Uri');
if($uri->path[0] != 'Login') {
ob_start();
header("Location: http://solartutorial/Login");
ob_end_flush();
exit;
}
}
}
and it works great. Thanks!
Sean
More information about the Solar-talk
mailing list