auth component issue

Posted by madphp on Stack Overflow See other posts from Stack Overflow or by madphp
Published on 2011-01-20T04:01:55Z Indexed on 2011/11/23 17:51 UTC
Read the original article Hit count: 410

Filed under:
|

Im trying to get my admin routing working with the auth component. I want the following routing to work.

Router::connect('/admin', array('controller' => 'pages', 'action' => 'index', 'admin' => true));

but when i type in /admin it redirects to /admin/users/login and display this error.

Create UsersController::admin_login() in file: cms.local/controllers/users_controller.php

here is my app_controller code.

class AppController extends Controller {

    var $components = array('DebugKit.Toolbar','Auth','Session');

    function beforeFilter(){

        //Set up Auth Component
        $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
        $this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'admin_index');
        $this->Auth->allow('display');

    }

}

users_controller

<?php
class UsersController extends AppController {

    var $name = 'Users';

    function login(){

    }

    function admin_logout(){
        $this->Session->destroy();
        $this->redirect($this->Auth->logout());
    }

}
?>

If you require more information let me know.

Thanks

© Stack Overflow or respective owner

Related posts about cakephp

Related posts about cakephp-1.3