Auth Login Component not working :(

2009-01-05 Thread Darren884

Hi I am trying to return a rendered element so I have to customize the
login() function on the controller I am using, however its not running
the query right even though the fields it is supposed to process are
defined in the model.

Here is the beforeRender code:
PHP Code:


function beforeFilter() {

$this-Auth-loginAction = array(

'controller' = 'users',

'action' = 'login_form'

);

$this-Auth-allow(array(

'login_form',

'login',

'logout'

));

$this-Auth-redirectLogin = array(

'controller' = 'users',

'action' = 'index'

);

}



Here is my login function:
PHP Code:


function login() {

$this-layout = null;

if ($this-Auth-login($this-data['User'])) {

$this-render('login_success', 'ajax');

} else {

$this-render('login_failure', 'ajax');

}

}



The data in the form is named as
data['User']['username'] and data['User']['password']

Does anyone know why the login function won't correctly process this?
Thanks
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Login Component not working :(

2009-01-05 Thread gearvOsh

Leave your login() action empty. CakePHP automatically does all the
login magic.

http://www.milesj.me/blog/read/5/using-cakephps-auth-component/
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---