Welcome Guest, Not a member yet? Register   Sign In
Community Auth
#1

Hey Guys, 

I'm using  Community Auth and for each action in my app i'm redirected to the login page. 

Here is the MY_Controller code ;
PHP Code:
require_once APPPATH 'third_party/community_auth/core/Auth_Controller.php';
require_once 
APPPATH 'third_party/community_auth/helpers/auth_helper.php';

class 
MY_Controller extends Auth_Controller
{
    
/**
     * Class constructor
     */
    
public function __construct()
    {
        
parent::__construct();
    }
}

class 
Front_Controller extends MY_Controller
{
    
/**
     * Class constructor
     */
    
public function __construct()
    {
        
parent::__construct();

        
/*Load */
        
$this->load->library(array('template''session'));
        
$this->load->helper(array('url''form''auth_helper'));
    }
}

class 
Back_Controller extends MY_Controller
{
    
/**
     * Class constructor
     */
    
public function __construct()
    {
        
parent::__construct();

        if (
$this->require_min_level(1))
        {

        }
        
/*Load */
        
$this->load->library(array('template''form_validation''table''pagination'));
        
$this->load->helper(array('url''form''array''date'));
        
$this->load->model(array('organization_model''visit_model''level_model''dashboard_model''user_model'));

    }



Here is my dashboard controller : 
PHP Code:
class Dashboard extends Back_Controller
{
    public function 
__construct()
    {
        
parent::__construct();
        
//Do your magic here
    
}

    public function 
index()
    {

            
/*Set page title*/
            
$this->data['title'] = "Tableau de Bord";

            
/*Get all data*/
            
if ($this->verify_role('agent,manager'))
            {
                
$this->data['all_visits'] = $this->dashboard_model->count_all_visits($this->auth_user_id);
                
$this->data['attempting_visits'] = $this->dashboard_model->count_all_attempting_visits($this->auth_user_id);
                
$this->data['opened_visits'] = $this->dashboard_model->count_all_opened_visits($this->auth_user_id);
                
$this->data['closed_visits'] = $this->dashboard_model->count_all_closed_visits($this->auth_user_id);
            }
            else
            {
                
$this->data['all_visits'] = $this->dashboard_model->count_all_visits();
                
$this->data['attempting_visits'] = $this->dashboard_model->count_all_attempting_visits();
                
$this->data['opened_visits'] = $this->dashboard_model->count_all_opened_visits();
                
$this->data['closed_visits'] = $this->dashboard_model->count_all_closed_visits();
            }

            
/*Load Template*/
            
$this->template->back_render('backend/dashboard'$this->data);

    }



and here the dahboard view
Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>

<!-- Right side column. Contains the navbar and content of the page -->
       <aside class="right-side">
           <!-- Main content -->
           <section class="content-header">
               <h1><?php echo $title; ?></h1>
               <ol class="breadcrumb">
                   <li class="active">
                       <a href="#">
                           <i class="livicon" data-name="home" data-size="14" data-color="#333" data-hovercolor="#333"></i> Tableau de bord
                       </a>
                   </li>
               </ol>
           </section>
           <section class="content">
               <div class="row">
                   <div class="col-lg-3 col-md-6 col-sm-6 margin_10 animated fadeInLeftBig">
                       <div class="lightbluebg no-radius">
                           <div class="panel-body squarebox square_boxs">
                               <div class="col-xs-12 pull-left nopadmar">
                                   <div class="row">
                                       <div class="square_box col-xs-7 text-right">
                                           <span>Toutes les visites</span>
                                           <div class="number" id="myTargetElement1"><a href="<?php echo site_url('backend/visit'); ?>"><?php echo $all_visits; ?></a></div>
                                       </div>
                                   </div>
                               </div>
                           </div>
                       </div>
                   </div>
                   <div class="col-lg-3 col-md-6 col-sm-6 margin_10 animated fadeInUpBig">
                       <!-- Trans label pie charts strats here-->
                       <div class="redbg no-radius">
                           <div class="panel-body squarebox square_boxs">
                               <div class="col-xs-12 pull-left nopadmar">
                                   <div class="row">
                                       <div class="square_box col-xs-7 pull-left">
                                           <span>Visites en attente</span>
                                           <div class="number" id="myTargetElement2"><a href="<?php echo site_url('backend/visit#attempt'); ?>"><?php echo $attempting_visits; ?></a></div>
                                       </div>
                                   </div>
                               </div>
                           </div>
                       </div>
                   </div>
                   <div class="col-lg-3 col-sm-6 col-md-6 margin_10 animated fadeInDownBig">
                       <!-- Trans label pie charts strats here-->
                       <div class="goldbg no-radius">
                           <div class="panel-body squarebox square_boxs">
                               <div class="col-xs-12 pull-left nopadmar">
                                   <div class="row">
                                       <div class="square_box col-xs-7 pull-left">
                                           <span>Visites en cours</span>
                                           <div class="number" id="myTargetElement3"><a href="<?php echo site_url('backend/visit#opened'); ?>"><?php echo $opened_visits; ?></a></div>
                                       </div>
                                   </div>
                               </div>
                           </div>
                       </div>
                   </div>
                   <div class="col-lg-3 col-md-6 col-sm-6 margin_10 animated fadeInRightBig">
                       <!-- Trans label pie charts strats here-->
                       <div class="palebluecolorbg no-radius">
                           <div class="panel-body squarebox square_boxs">
                               <div class="col-xs-12 pull-left nopadmar">
                                   <div class="row">
                                       <div class="square_box col-xs-7 pull-left">
                                           <span>Visites Terminées</span>
                                           <div class="number" id="myTargetElement4"><a href="<?php echo site_url('backend/visit#closed'); ?>"><?php echo $closed_visits; ?></a></div>
                                       </div>
                                   </div>
                               </div>
                           </div>
                       </div>
                   </div>
               </div>
           </section>
       </aside>
       <!-- right-side -->

Each time a connected user clicks on a link he gets redirection to the login page before. 
Also when i remove the require_min_level condition, the authentication are not loaded and i get the undefined variable errors.
I get thess issues with all of my pages.
Please can anyone help me on these issues ?
Thanks in advance !!!
Reply


Messages In This Thread
Community Auth - by filipirie - 12-25-2017, 02:07 AM
RE: Community Auth - by skunkbad - 12-25-2017, 10:59 AM
RE: Community Auth - by filipirie - 12-26-2017, 02:22 AM
RE: Community Auth - by skunkbad - 12-26-2017, 09:04 AM
RE: Community Auth - by filipirie - 12-26-2017, 09:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB