calzone, Put your authentication code in a file called app_controller.php which resides at the same level as the models/controllers directories.
All controllers will inherit from it and similarly all models will inherit from an app_model.php file. Exclude the authentication check if the current page you are on is the login page. Huy calzone wrote: > Authentication rears it's ugly head again. > > I've been working on my own authentication scheme. I got it working on > a single controller, but I'm loathe to have to think of adding it to > every single controller. So I was trying out using beforeFilter in > cake/app_controller.php to perform the authentication. > > Well aside from the obvious problem suggested by this topic, namely > that now I would have all my pages protected, I'm finding I can't > really get it working at all. The problem seems to be an endless loop > because whenever app_controller detects the user is not logged in, it > tries to take action to ask that user to log in, which in turn means a > new controller, which inherits app_controller to begin with. > > Obviously, I'm going about this the wrong way. Is there a right way, > or do I dimply have to relegate myself to adding this bit of > beforeFilter to every single *_controller.php? > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---
