When isAuthorized() returns false I get redirected to "/" which then
redirects to "pages controller"...
Here is my code:
App_controller:
class AppController extends Controller {
var $components = array('Auth', 'Session');
var $helpers = array('Javascript', 'Html', 'Form', 'Ajax',
'Session');
function beforeFilter() {
$this->Auth->authorize = 'controller';
$this->Auth->userModel = 'Member';
Security::setHash("md5");
$this->Auth->fields = array('username' => 'email', 'password' =>
'password');
$this->Auth->loginAction = array('controller' => 'members',
'action' => 'add');
$this->Auth->loginRedirect = array('controller' => 'members',
'action' => 'myaccount');
$this->Auth->logoutRedirect = array('controller' => 'members',
'action' => 'login');
$this->Auth->autoRedirect = false;
}
}
and here is my members controller:
function isAuthorized(){
switch ($this->action) {
case "index":
return ($this->Auth->user('rol') == 'admin');
break;
default:
return true;
}
}
/* function that handles the login*/
function login(){
if($this->Auth->login()){
if($this->Auth->user('rol') == 'member'){ #check if it
is a member
or an admin
$this->redirect('myaccount');
}elseif ($this->Auth->user('rol' == 'admin')) {
$this->redirect('index');
}
}
}
I have tried changing all properties of Auth in app_controller with no
results, it always redirects to "/"
I just want to redirect to the login page or maybe just show a
message.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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