public function __construct(Request $request)
{
parent::__construct($request);
if (!Kohana::config('shindig.use_authentication')) {
// Redirect to the home page
$this->request->redirect('');
}
if ($user = Cookie::get('authorized')) {
$user = Sprig::factory('user', array('username' => $user))->load();
if ($user->loaded()) {
// User is logged in
$this->user = $user;
Shindig::$has_auth = TRUE;
}
}
if (!$this->user) {
// Force the user to login
$this->request->action = 'login';
}
}