Welcome Guest, Not a member yet? Register   Sign In
Extending My_Controller with an Auth layer.
#7

[eluser]Phil Sturgeon[/eluser]
[quote author="Joshua Logsdon" date="1265059090"]I second that.

@gh0st: Just a little reminder if you start out with this, a login page or other public-facing/unprotected pages that are part of your "admin" still need to extend your Public_controller to be accessed as shown by Phil.[/quote]

That's not entirely true. If you want an admin only login page then you can still extend the Admin_Controller and just do something like:

Code:
<?php
class Admin_Controller extends MY_Controller
{
    protected $allowed_pages = array(
        'auth/login',
        'auth/forgot_password',
        'auth/reset_password'
    );
    
    public function __construct()
    {
        parent::__construct();
        
        if( !in_array($this->controller . '/' . $this->method, $this->allowed_pages) )
        {
            if (!$this->logged_in )
            {
                redirect('admin/login');
            }
            
            // Make sure they are a customer, clients and admins should not be allowed into the client area
            if(!$this->ion_auth->is_admin())
            {
                show_error('Get the fudge out.');
            }
        }
        
        $this->template->set_layout('admin/layout');
    }
}


[quote author="Devon Lambert" date="1265085764"]That being said, I did make a change in the way I handle logins. This is because Tank_Auth generally feels like better authentication than that provided in PyroCMS, sorry Phil :-).[/quote]

Agreed, mine is a bit of a mess and will soon be replaced with Ion Auth which I have been working on a lot, or hopefully the Auth system Rick Ellis is building.


Messages In This Thread
Extending My_Controller with an Auth layer. - by El Forum - 02-01-2010, 07:20 AM
Extending My_Controller with an Auth layer. - by El Forum - 02-01-2010, 07:56 AM
Extending My_Controller with an Auth layer. - by El Forum - 02-01-2010, 09:18 AM
Extending My_Controller with an Auth layer. - by El Forum - 02-01-2010, 11:49 AM
Extending My_Controller with an Auth layer. - by El Forum - 02-01-2010, 04:42 PM
Extending My_Controller with an Auth layer. - by El Forum - 02-02-2010, 03:35 AM
Extending My_Controller with an Auth layer. - by El Forum - 02-02-2010, 05:26 AM
Extending My_Controller with an Auth layer. - by El Forum - 02-02-2010, 05:42 AM
Extending My_Controller with an Auth layer. - by El Forum - 02-15-2010, 11:47 AM
Extending My_Controller with an Auth layer. - by El Forum - 02-15-2010, 03:28 PM
Extending My_Controller with an Auth layer. - by El Forum - 02-16-2010, 02:40 AM
Extending My_Controller with an Auth layer. - by El Forum - 02-16-2010, 03:12 AM
Extending My_Controller with an Auth layer. - by El Forum - 02-16-2010, 10:05 AM
Extending My_Controller with an Auth layer. - by El Forum - 02-16-2010, 12:00 PM
Extending My_Controller with an Auth layer. - by El Forum - 02-16-2010, 04:02 PM
Extending My_Controller with an Auth layer. - by El Forum - 02-16-2010, 08:32 PM
Extending My_Controller with an Auth layer. - by El Forum - 02-16-2010, 08:46 PM
Extending My_Controller with an Auth layer. - by El Forum - 02-16-2010, 09:00 PM
Extending My_Controller with an Auth layer. - by El Forum - 02-16-2010, 09:22 PM
Extending My_Controller with an Auth layer. - by El Forum - 02-17-2010, 06:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB