hi,
i m working on auth component in cake.
 the login is working but log out is not secured.
when user logged out he should not move forward without login but
still he can
can any one tel me hoe to restrict user form moving forward without
login.


this is my app controller


<?php
class AppController extends Controller{

        var $components = array('Auth');

         function beforeFilter() {
                $this->Auth->allow('admin_add');
                //Security::setHash('md5');

                // Authenticate
                $this->Auth->loginAction = array('controller' => 'users', 
'action'
=> 'login');
                $this->Auth->loginRedirect = array('controller' => 'users', 
'action'
=> 'admin_index');
                $this->Auth->loginError = 'No username and password was found 
with
that combination.';
                //$this->Auth->logoutRedirect = '/';
                //$this->Auth->authorize = 'controller';


        }

        function isAuthorized() {

                if (isset($this->params[Configure::read('Routing.admin')])) {

                        // Usage: $this->Auth->user('field_in_user_model');

                        if ($this->Auth->user('group_id') != 1) {

                                return false;

                        }else{

                        return true;

                }
          }

   }



        function beforeRender() {

                if('admin_' == substr($this->action, 0,6)){
                        $this->layout = 'admin';
                }else if('manager_' == substr($this->action, 0,8)){
                        $this->layout = 'manager';
                }else{
                        $this->layout = 'default';
        }
  }

 }
?>

//this is my user controller and login and lodout action

<?php
class UsersController extends AppController {
                var $components = array('Auth');
                var $helper = array('html' ,'form');
                var $name = 'Users';
                var $name1 = 'Category';
                var $uses = array('User', 'Category');


        function admin_login() {
        print_r($this->data);
    }

    function admin_logout() {
        $this->Session->setFlash('You have successfully logged out');
        $this->redirect(array('action'=>'login'));
                //$this->redirect($this->Auth->logout());
    }
}

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to