Hi.
I'm not sure what the problem is, I setup Auth in the app_controller,
and now every time (after logging in) i try to add or edit, I'm sent
directly back to the index with a message (flash) that says "The
(Controller) has been saved" without letting me enter any fields.
Am I missing adding some auth code to the views? Do I need to add the
parent::beforeFilter(); to every controller even if they don't have a
beforeFilter() function defined?
Here's what I added to the app_controller:
<?php
class AppController extends Controller {
var $components = array('Auth');
function beforeFilter() {
Security::setHash('md5');
// this is part of cake that serves up static pages, it should be
authorized by default
$this->Auth->allow('display');
// tell cake to look on the user model itself for the password
hashing function
$this->Auth->authenticate = ClassRegistry::init('User');
// tell cake where our credentials are on the User entity
$this->Auth->fields = array(
'username' => 'name',
'password' => 'pass',
);
// this is where we want to go after a login... we'll want to
make this dynamic at some point
$this->Auth->loginRedirect = array('controller'=>'partners',
'action'=>'index');
}
}
?>
This is what I added to one of my controllers: (every other controller
was fully working without auth before with add, edit, view, index and
del.
function beforeFilter(){
$this->Auth->allow('add','index');
parent::beforeFilter();
}
Any ideas are welcome. Thank you!
Germán.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---