Thursday, October 1, 2009

Re: Auth component loop redirect

Add

    $this->Auth->allow(array('login'));

to your beforeFilter()


Friendly greetings,
Bert

On Thu, Oct 1, 2009 at 1:27 PM, mathaios <mathaios76@gmail.com> wrote:

I'm using the Auth component as the example in the manual, but the log-
in form keeps redirecting to himself, and Firefox throws the error
"The page isn't redirecting properly".

My app controller is:

class AppController extends Controller {

       var $components=array('Auth','RequestHandler');

   function beforeFilter() {
               $this->Auth->loginAction = array('admin' => false,  'controller' =>
'users', 'action' => 'login');
               //$this->Auth->allow(array('*')); <<- if I uncomment this line it
"works" (allow all)
   }
}

my users controller (excerpt) is:

class UsersController extends AppController {

       var $name = 'Users';
       var $helpers = array('Html', 'Form');

       function login() {

       }

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

....

what I'm doing wrong ?



--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: