In my 'Users' controller I do this: beforeFilter() { $this->Auth->allow(array('logout') ); parent::beforeFilter(); }
function login() {} function logout() { $this->Auth->logout(); $this->flash("You are now logged out of the site.", '/' ); } I don't know if this is "correct", but it works. -Aran On May 10, 2:07 pm, Greg <[EMAIL PROTECTED]> wrote: > Hi, I'm having several, probably related, problems with the Auth > class. First of all, I'm a Cake noob but I've been searching for > answers and have finally resorted to posting. > > My app requires authentication before access to any controller/action. > On my shared server I can't use 'users' or 'admin' URI segments > because they are used for hosting account management. Therefore in > app_controller I have created an 'Account' model for Auth. My > app_controller looks like this: > > [code] > <?php > class AppController extends Controller { > > var $components = array('Auth'); > > function beforeFilter() { > $this->Auth->userModel = 'Account'; > $this->Auth->loginAction = array('controller' => 'accounts', > 'action' => 'login'); > $this->Auth->logoutRedirect = array('controller' => > 'accounts', > 'action' => 'login'); > } > > } > > ?> > [/code] > > I have the login and logout functions from the manual in my accounts > controller. On trying to access any page I get redirected to /accounts/ > login, which is what I expect to happen. However, if I try to logout, > say at /accounts/logout, then instead of being redirected to /accounts/ > login I'm being redirected to /users/logout, which of course causes a > 404. I suspect I may not fully understand how Auth is supposed to work > but what have I done wrong here? > > Cheers --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---