I was looking at the official bookmark tutorial for the user registration page (/ users/add).$this - > Auth - > allow ([’ logout ', ‘add’]);This statement is not accessible to UsersController and is directly skipped to the login page;If you add to the AppController, you can access the registration page.Is this correct?Or did I write something wrong?
I’m not sure I understand your question. I’ll do my best to respond.
allow([…actions…]) is specific to the Controller that is executing. If you place it in the App controller it will apply to all actions named “add”. It’s best therefore to keep it in the currently executing controller.
If registration is in the add() method of your users controller, you want to add $this->Auth->allow([‘add’]) to the beforeFilter function of the users controller and that should allow unauthenticated users access.
Hope that helps.
Thank you very much.
I found that I write wrong. Correct term $this->Auth->allow([‘logout’, ‘add’]); My writing is $this->Auth->allow(‘logout’, ‘add’)