I'm fairly new to cakePhP so excuse me if im missing the obvious. I'm building an application using secure forms by using the 'Security' component which i've set up in the main app_controller.php
This is all working fine, all my forms are secure except for one condition after an expired session and if the call is via ajax which i'll explain : In app_controller beforeFilter() method i run a check __checkUserLoggedIn() to ensure the session user is valid before proccessing any actions, if this fails it redirects to /members/login. At this point i notice 2 curious things i'm not sure how to overcome. If the redirect happens in an Ajax call it doesn't use the Ajax layout to render the login view although if i die($this->layout) it tells me it's 'ajax'. I overcame this by doing this in the login view: if($this->layout == 'ajax'){ $json['html'] = $this->renderElement('loginpage'); echo json_encode($json); }else{ echo $this->renderElement('loginpage'); } This works and renders the login form via Ajax Except that in the Ajax call the form is not Secure and is missing the hidden Target and Fields fields and thus submiting this login form fails to work. So it appears that if i redirect in the beforeFilter() method during an ajax call i loose the ajax layout as well as the 'Security' feature of the forms after the redirect. Any ideas what i'm doing wrong? Many Thanks Simon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---