Note that there are some explanatory texts on larger screens.

plurals
  1. POCakephp 2 ACL ERR_TOO_MANY_REDIRECTS
    primarykey
    data
    text
    <p>I am trying to implement the ACL tutorial found here: <a href="http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html" rel="nofollow">http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html</a></p> <p>I followed all the instructions, however when I try to go to <strong>[my_site]/users/add</strong> ERR_TOO_MANY_REDIRECTS error.</p> <p>I found this on the Cakephp website:</p> <blockquote> <p>This happens when for example we have an element that receives data from a method of a controller, and the implementation of this method requires conducting the login would create an infinite loop that eventually will cause the browser to decline redirects</p> </blockquote> <p>And they suggest this as the fix:</p> <pre><code>function beforeFilter () { $ this -&gt; Auth -&gt; allow ( 'CONTROLLER_NAME' ); } </code></pre> <p>Which doesn't seem to work.</p> <p>If I change the AppController from this:</p> <pre><code>public function beforeFilter() { $this-&gt;Auth-&gt;allow('index', 'view', 'login', 'add'); } </code></pre> <p>to:</p> <pre><code>public function beforeFilter() { $this-&gt;Auth-&gt;allow('*'); } </code></pre> <p>I dont get the error anymore but get redirected to <strong>[my_site]/users/login</strong></p> <p>Any suggestions as to what I am doing wrong that I can't view the User-Add page? TIA!</p> <p>UserController:</p> <pre><code>public function beforeFilter() { parent::beforeFilter(); $this-&gt;Auth-&gt;allow('add'); } </code></pre> <p>Login function (UsersController):</p> <pre><code>Public function login() { if ($this-&gt;request-&gt;is('post')) { if ($this-&gt;Auth-&gt;login()) { $this-&gt;redirect($this-&gt;Auth-&gt;redirect()); } else { $this-&gt;Session-&gt;setFlash(__('Invalid username or password, try again')); } } } </code></pre> <p>Auth Component Loader:</p> <pre><code>public $components = array( 'Session', 'RequestHandler', 'Auth' =&gt; array( 'loginRedirect' =&gt; array('controller' =&gt; 'projects', 'action' =&gt; 'index'), 'logoutRedirect' =&gt; array('controller' =&gt; 'pages', 'action' =&gt; 'display', 'home') ) ); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload