I have installed tank auth to save me time creating a authentication script.
As I am using HMVC, tank auth has it's own module (modules/auth).
How can I protect my other modules (/admin, /members etc) with the login script??
From what I have read I need to do something like:
modules::run('auth/is_logged_in');
My auth controller looks like:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Auth extends MX_Controller
{
function __construct()
{
parent::__construct();
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
//$this->load->library('security');
$this->load->library('tank_auth');
$this->lang->load('tank_auth');
}
function index()
{
if ($message = $this->session->flashdata('message')) {
//$this->load->view('auth/auth/general_message', array('message' => $message));
$main_content = 'auth/auth/general_message';
$this->load->view('includes/template', array('message' => $message, 'main_content' =>$main_content));
} else {
redirect('auth/login/');
}
}
/**
* Login user on the site
*
* @return void
*/
function login()
{
if ($this->tank_auth->is_logged_in()) { // logged in
redirect('admin');
} elseif ($this->tank_auth->is_logged_in(FALSE)) { // logged in, not activated
redirect('auth/send_again/');........
an the controller/module I want to protect with the login script:
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Admin extends MX_Controller {
public function __construct(){
parent::__construct();
modules::run('auth/auth/login');
}
The above does not seem to work? What am I missing?