I added a beforeFilter() in my app_controller.php in order to force a
user to the login page if their session doesn't exist:
class AppController extends Controller{
function beforeFilter(){
if (!$this->params){
exit();
}
if ($this->params['controller'] == 'users' && $this-
>params['action'] == 'login' ){
}elseif (!$this->Session->check('User') ) {
$this->Session->setFlash(__('Please login before
continuing.',
true));
$this->redirect('/users/login');
}
}
}
?>
as you can see, the beforeFilter() exits if the user is at the /users/
login view.
in my view I referenced a different controller that wasn't '/users/
login' in this case the "captcha" action:
<img src="<?php echo $html->url('/users/captcha');?>
Apparently, the helper was blocked by the beforeFilter() in
app_controller.php!
so I just added a clause in the if statement in the beforeFilter() to
allow access to '/users/captcha' like this:
if ($this->params['controller'] == 'users' && $this->params['action']
== 'login' || $this->params['controller'] == 'users' && $this-
>params['action'] == 'captcha'){
and that did it!
Wow, I'm glad I figured it out!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---