Friday, August 24, 2012

Re: Basic ACL tutorial in 1.3 book will not work because Auth is not setting Auth.User

Can anyone help me?

On Sunday, August 5, 2012 7:13:02 PM UTC-4, osucoder wrote:
I cannot get the login function to work after following the acl tutorial.  I'm getting an "Auth.User doesn't exist" error when I dump the Session variable after calling "$this->Session->read('Auth.User);"  If searched all over the place for an answer and I am yet to find one.  Any help would be greatly appreciated.  Thank you.

app_controller

  1     <?php
  2     class AppController extends Controller {
  3         var $components = array('Acl', 'Auth', 'Session', 'Cookie');
  4         var $helpers = array('Html', 'Form', 'Session');
  5         function beforeFilter(){
  6             //Configure AuthComponent
  7             $this->Auth->actionPath = 'controllers/';
  8             $this->Auth->authorize = 'actions';
  9             $this->Auth->loginAction = array('controller'=>'users', 'action'=>'login');
 10             $this->Auth->logoutRedirect = array('controller'=>'users', 'action'=>'logout');
 11             $this->Auth->loginRedirect = array('controller'=>'posts', 'action'=>'add');
 12             $this->Auth->allowedActions = array('display');
 13         }
 14     }
 15 ?>


login action

  6
  7     function login(){
  8         if($this->Session->read('Auth.User')){
  9             $this->Session->setFlash('You are logged in!');
 10             $this->redirect('/', null, false);
 11
 12         }
 13         debug($this->Auth, true);
 14     }

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate