Hello
I appreciate there's a lot of discussion and a few tutorials on Auth
in 1.2, but for some reason I can't get it to work at all - even at a
basic level. I'm probably doing something noobtastically wrong, so I
apologise in advance for my stupidity if so, but I wonder if someone
wouldn't mind giving me some pointers on this.
I've set up my login page, my users controller and app_controller, but
when I attempt to login, nothing happens. Nothing. No error message,
no redirection, no cakephp error, just nothing.
Here's my login.ctp:
echo $form->create('User', array('controller' => 'users', 'action' =>
'login'))."\n";
echo $form->input('email')."\n";
echo $form->input('password')."\n";
echo $form->checkbox('remember_me')."\n";
echo $form->label('remember_me', 'Stay logged in?')."\n";
echo $form->end('Login')."\n";
Here's my users_controller.php:
var $name = 'Users';
var $uses = array('User', 'Setting');
function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('register');
}
function index() {
// some stuff for the user once logged in
}
function login() {
// I will have cookie stuff here if I can get it to
work
}
function logout() {
$this->Session->setFlash("You've successfully logged out.");
$this->redirect($this->Auth->logout());
}
My app_controller.php:
var $helpers = array('Html','Javascript','Form');
var $components = array('Acl','Auth','Cookie','Security');
var $publicControllers = array('pages');
function beforeFilter() {
if (isset($this->Auth)) {
$this->Auth->fields = array('username' => 'email',
'password' =>
'password');
$this->Auth->loginAction = array('controller' =>
'users', 'action'
=> 'login');
$this->Auth->loginRedirect = array('controller' =>
'users',
'action' => 'index');
$this->Auth->logoutRedirect = '/';
$this->Auth->userModel = 'User';
$this->Auth->userScope = array('User.status' =>
'Activated');
$this->Auth->loginError = 'Invalid email / password
combination.
Please try again';
if (in_array(low($this->params['controller']), $this-
>publicControllers)) {
$this->Auth->allow();
}
}
}
I know I've got to implement ACL, but surely I should be getting error
messages for incorrect passwords even now? Grateful for anyone's
input!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---