Please don't apologise! It's all good. I just wanted to set the record straight for anyone who might come across the thread.Thanks again, this was driving me nuts.
2009/4/9 Jorge Horacio Cué Cantú <[email protected]>: > Your wellcome, sorry for the small mistake. > > > 2009/4/9 brian <[email protected]> >> >> 2009/4/9 Jorge Horacio Cué Cantú <[email protected]>: >> > Hello, >> > >> > >> > Set >> > >> > $this->Auth->redirect = false >> > >> > in AppController::beforeFilter(). >> > >> > The the login() action will be called after a successful login. >> > >> >> Thanks, that's it (sort of). The var is actually >> $this->Auth->autoRedirect. >> >> So, for the record: >> >> AppController: >> function beforeFilter() >> { >> $this->Auth->fields = array('username' => 'email', 'password' => >> 'password'); >> $this->Auth->loginError = 'No matching user found.'; >> $this->Auth->loginAction = array('controller' => 'users', 'action' >> => 'login'); >> $this->Auth->loginRedirect = array('controller' => 'pages', >> 'action' >> => 'display', 'home'); >> $this->Auth->autoRedirect = false; >> $this->Auth->logoutRedirect = array('controller' => 'users', >> 'action' >> => 'login'); >> >> if (isset($this->params['admin']) && $this->params['admin']) >> { >> $this->layout = 'admin'; >> } >> } >> >> >> UsersController: >> public function login() >> { >> if ($user = $this->Auth->user()) >> { >> $this->User->id = $user['User']['id']; >> $this->User->saveField('last_login', date('Y-m-d H:i:s')); >> >> if (!$user['User']['eula_accepted']) >> { >> $this->redirect( >> array('controller' => 'users', 'action' => >> 'eula') >> ); >> } >> $this->redirect($this->Auth->loginRedirect); >> } >> } >> >> public function eula() >> { >> if (!empty($this->data) && $this->data['User']['eula_accepted']) >> { >> $this->User->id = $this->Auth->user('id'); >> $this->User->saveField('eula_accepted', 1); >> $this->Session->write('Auth.User.eula_accepted', 1); >> >> $this->redirect( >> array('controller' => 'pages', 'action' => >> 'display', 'home') >> ); >> } >> } >> >> Thanks again, Jorge! >> >> > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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?hl=en -~----------~----~----~----~------~----~------~--~---
