1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
<?php defined('BASEPATH') or exit('No direct script access allowed');
/*
* Controller extended by other controllers that load private access views
*/
class Auth_controller extends MY_Controller
{
public function __construct()
{
parent::__construct('templates/auth');
$this->_auth_logged_in();
// add admin jscripts in auth area
$this->data['jscripts'] = ['admin.vendors', 'admin'];
$this->data['styles'] = ['admin'];
}
/**
* Checks if user is authenticated
*/
private function _auth_logged_in()
{
//Check if user is authenticated
if ($this->ion_auth->logged_in() === false) {
redirect_lang('admin/login');
}
}
}