Re: Auth component troubles
Hi, I think there is nothing wrong in your code, but probably your missing something like public function login(){ if ($this-Auth-login()) { $this-redirect($this-Auth-redirect()); } else { $this-Session-setFlash(__('Invalid username or password, try again')); } } in your User controller. You could use that declaration in app controller, which is more compact: class AppController extends Controller { var $components = array( 'Auth' = array( 'fields'=array( 'username' = 'email', 'password' = 'password' ), 'loginError' = Wrong! ) ); function beforeFilter() { } } Hope this help Luca Il 27/12/2011 08:01, Clint ha scritto: class AppController extends Controller { var $components = array('Auth'); function beforeFilter() { $this-Auth-fields = array( 'username' = 'email', 'password' = 'password' ); $this-Auth-loginError = Wrong!; } -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Auth component troubles
Thanks for your suggestions Luca. After looking at my code again this morning, I discovered my mistake. Somehow I'd given App_Controller a ctp extension.. doh! Explains why it wasn't being read. Clint Hi, I think there is nothing wrong in your code, but probably your missing something like public function login(){ if ($this-Auth-login()) { $this-redirect($this-Auth-redirect()); } else { $this-Session-setFlash(__('Invalid username or password, try again')); } } in your User controller. You could use that declaration in app controller, which is more compact: class AppController extends Controller { var $components = array( 'Auth' = array( 'fields'=array( 'username' = 'email', 'password' = 'password' ), 'loginError' = Wrong! ) ); function beforeFilter() { } } Hope this help Luca Il 27/12/2011 08:01, Clint ha scritto: class AppController extends Controller { var $components = array('Auth'); function beforeFilter() { $this-Auth-fields = array( 'username' = 'email', 'password' = 'password' ); $this-Auth-loginError = Wrong!; } -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Auth component troubles
I'm having troubles with the Auth component using CakePHP 1.3 I expected the following to work: ?php class AppController extends Controller { var $components = array('Auth'); function beforeFilter() { $this-Auth-fields = array( 'username' = 'email', 'password' = 'password' ); $this-Auth-loginError = Wrong!; } } ? ?php class UsersController extends AppController { var $name = 'Users'; function login() { } function logout() { $this-redirect($this-Auth-logout()); } } ? Yet it won't authenticate correctly until I move the beforeFilter() from AppController and put it in the UsersController, along with adding var $components = array('Auth'); which the Cake Book says: Not necessary if declared in your app controller which appears to be incorrect. I want to declare all the Auth variables in the AppController so that they're site-wide, but it doesn't work when I do. Any suggestions one what I've done wrong? Thanks! Clint -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php