I'm attempting to use the Auth component to do pretty basic auth with no acl in cake 1.2.x.x trunk.
It seems to be working fine when I have controllers but no explicit models classes defined. However, once I declare a simple model class I see the following error no matter which action I navigate to: Warning (2): Cannot modify header information - headers already sent by (output started at /home/aaron/workspaces/CakePHP/cake/libs/ controller/components/auth.php:226) [CORE/cake/libs/controller/ controller.php, line 576] Code | Context $status = "Location: http://sharecake/users/login" header - [internal], line ?? Controller::header() - CORE/cake/libs/controller/controller.php, line 576 Controller::redirect() - CORE/cake/libs/controller/controller.php, line 557 AuthComponent::startup() - CORE/cake/libs/controller/components/ auth.php, line 326 Component::startup() - CORE/cake/libs/controller/component.php, line 98 Dispatcher::start() - CORE/cake/dispatcher.php, line 307 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 219 [main] - APP/webroot/index.php, line 86 The model (User in this case) is an empty class that just extends AppModel. Once I delete the model class it works again. My controller class looks like: <?php class UsersController extends AppController { var $helpers = array('Html','Form'); function login() { } function logout() { $this->Session->destroy(); $this->redirect($this->Auth->logout()); } function register() { if ($this->Auth->user()) { $this->Session->setFlash('User already logged in'); $this->redirect($this->Auth->redirect()); exit(0); } $this->pageTitle = 'Register User'; if (!empty($this->data)) { if ($this->User->save($this->data['User'])) { $this->Session->setFlash('User Registered!'); $this->redirect('/users/login'); exit(0); } } } function home() { } } ?> If I define another controller with no model class defined it works when using the new controller. But once I define the model class it breaks again. Any ideas on what I'm missing? app_controller.php looks like: class AppController extends Controller { var $components = array('Auth'); function beforeFilter() { parent::beforeFilter(); // $this->Auth->fields = array('username' => 'userid','password' => 'password'); $this->Auth->allow('register'); // $this->Auth->autoRedirect = false; // $this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'home'); $this->layout = 'sharecake'; } } -Aaron --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
