Redirect Loop
Hello- I'm having the weirdest Cake error with my code. When the code below calls the add() method (also reproduced here and from a different controller), the code redirects him back the edit() action (in essence, to the user it appears as if nothing happens). To further complicate matters, when I call the same URL when I'm not on that page (despite the pages not being reliant on each other), I get redirected to the base of my app, which results in a redirect loop. I tried calling other methods from this controller (with their proper arguments) to see if this was just a problem with the add() action, but I get the same redirect loop. Here is the relevant code: function edit($id=null) { if(!$id) { $this->Session->setFlash('Invalid!'); $this->redirect(array( 'action' => 'index') ); } else { //Get the slides themselves $slides = $this->Slide->find('all', array('conditions' => array('Slide.module_id' => $id))); $this->set('slides', $slides); //Get the data for the Module $module = $this->Module->find('first', array( 'conditions' => array ( 'Module.id' => $id ), 'fields' => array( 'Module.module_name', 'Module.id') ) ); } } And here is the add() code (again, from a different module): function add($module = null) { if ($this->request->is('get')) { //Set some variables for the view (this code I know works as it has been used successfully elsewhere } else { //User is POSTing $this->Slide->create(); $this->Slide->save($this->data); } } Thanks to everyone in advance; I couldn't do this without your support! Andrew -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Authorization causing redirect loop
> public function beforeFilter() { > $this->Auth->allow('index', 'view'); > $this->set('logged_in', $this->Auth->loggedIn()); > $this->set('current_user', $this->Auth->user()); > } The Auth->allow() should be in UsersController. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Authorization causing redirect loop
Hi there, I have posted on another group, but had no replies, so please forgive me if this is a double up. I am still fairly new at cake and have been trying, very unsuccessfully to setup a login to some admin tools on a site I have built using Cake 2. I have now tried about 4 different methods for implementing the Auth component and every time I add the Auth component to my AppController, I get a redirect loop error. Even if I go to a supposedly "allowed" page, this happens. I have just finished doing a tutorial on yet another Auth implementation and have setup the tutorials app fine and it works perfectly. But the minute I port this across to my app, it gives me the redirect loop error. Since I have now tried this with 4 different Auth implementations, my assumption is that the issue is not in the Auth implementation code, but in my origional Cake app. But, I cannot fathom where to start looking and what exactly I am looking for. I am pasting the current AppController Auth code below. The problem appears to happen when the redirect to users/login happens. I have tried turning redirect off with autoRedirect = false. I have tried changing where the redirect should go as well. none seems to work. Any ideas on where the problem might lie would be much appreciated. Here's the code for the AppController: array( 'loginRedirect'=>array('controller'=>'users', 'action'=>'index'), 'logoutRedirect'=>array('controller'=>'users', 'action'=>'index'), 'authError'=>"You can't access that page", 'authorize'=>array('Controller') ) ); public function isAuthorized($user) { return true; } public function beforeFilter() { $this->Auth->allow('index', 'view'); $this->set('logged_in', $this->Auth->loggedIn()); $this->set('current_user', $this->Auth->user()); } } ?> Thanks in advance, Nikki -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: cakephp-wizard Redirect Loop
On Mar 22, 2011, at 07:46, grady wrote: > The author of the tutorial you referenced mentioned submitting the form to > itself using 'url' => $this->here for the form created. This doesn't work > for me due to the following behavior: > > Page the form is on: > http://localhost/cakebox/create/wizard/artifact > > Form definition in my artifact.ctp view: > Form->create('Create', array('id' => 'CreateForm', 'url' => > $this->here)); ?> > > Page the form sends me to upon submission: > http://localhost/cakebox/cakebox/create/wizard/artifact > > It's obvious what is doing, but I just want to understand why the author > included this on the tutorial when I can't see how it would ever work as > intended. It works fine for me, maybe because my CakePHP site is configured at the root of the hostname's URL space, and yours appears to be in a subdirectory ("/cakebox/"). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: cakephp-wizard Redirect Loop
Ah! Stupid mistake, my apologies. Somewhat of a follow-up question though... The author of the tutorial you referenced mentioned submitting the form to itself using 'url' => $this->here for the form created. This doesn't work for me due to the following behavior: Page the form is on: http://localhost/cakebox/create/wizard/artifact Form definition in my artifact.ctp view: Form->create('Create', array('id' => 'CreateForm', 'url' => $this->here)); ?> Page the form sends me to upon submission: http://localhost/cakebox/cakebox/create/wizard/artifact It's obvious what is doing, but I just want to understand why the author included this on the tutorial when I can't see how it would ever work as intended. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: cakephp-wizard Redirect Loop
The first thing I see is that your wizard() method assigns the parameter to the "$steps" variable, but never uses $steps within the method itself -- it passes the "$step" variable to $this->Wizard- >process(), and you haven't defined the value of the "$step" variable. I'm assuming you are trying to adapt the code from https://github.com/jaredhoyt/cakephp-wizard/wiki/Step-2:-View-Preparation-and-Data-Processing . Note the name of the variable being used for the parameter in the function wizard(). On Mar 20, 7:47 am, grady wrote: > I have installed the cakephp-wizard plugin from github and am trying to > progress through the tutorial but am unable to get past step one... > > I have set up a controller to handle the multi-page form as follows: > > class CreateController extends AppController { > var $name = "Create"; > var $components = array("Wizard.Wizard"); > var $uses = array("Artifact"); > function beforeFilter() { > $this->Wizard->steps = array("artifact");} > > function wizard($steps = null) { > $this->Wizard->process($step); > > } > > function _prepareArtifact() { > // TODO > > } > > function _processArtifact() { > $this->Artifact->set($this->data); > > if($this->Artifact->validates()) { > return true; > > } > return false; > } > } > > I have created a view for this controller in app/views/create/ called > artifact.ctp which contains a simple creation form. > > I have re-routed in app/config/routes.php so that /create points to > /create/wizard/artifact. > > When I try to navigate to the page Chrome (and Firefox, etc.) tells me that > there is a redirect loop. Is cakephp-wizard broken in cakephp 1.3.7, or > (more likely) am I doing something stupid? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
cakephp-wizard Redirect Loop
I have installed the cakephp-wizard plugin from github and am trying to progress through the tutorial but am unable to get past step one... I have set up a controller to handle the multi-page form as follows: class CreateController extends AppController { var $name = "Create"; var $components = array("Wizard.Wizard"); var $uses = array("Artifact"); function beforeFilter() { $this->Wizard->steps = array("artifact"); } function wizard($steps = null) { $this->Wizard->process($step); } function _prepareArtifact() { // TODO } function _processArtifact() { $this->Artifact->set($this->data); if($this->Artifact->validates()) { return true; } return false; } } I have created a view for this controller in app/views/create/ called artifact.ctp which contains a simple creation form. I have re-routed in app/config/routes.php so that /create points to /create/wizard/artifact. When I try to navigate to the page Chrome (and Firefox, etc.) tells me that there is a redirect loop. Is cakephp-wizard broken in cakephp 1.3.7, or (more likely) am I doing something stupid? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: redirect loop has me stumped
I found my problem. It was two problems really. The first problem was that $post was not set in the controller. The second problem was a misplaced parentheses in the redirect function. The third problem was I was creating urls that were hyphenated but forgot to add the second parameter to the Inflector::slug() function so that it was looping around never getting a match. On Jan 18, 2:30 pm, john lyles wrote: > Ok sorry. Here's a more full explanation: > > In my index.ctp I have links that look like this: $this->Html->link($post['Post']['title'], array('controller' => 'posts', > > 'action' => 'view', $post['Post']['id'],Inflector::slug($post['Post'] > ['title'], '-'))); ?> > > Then in the PostsController view() method, this is what it looks like: > > function view($id = null) { > if (!$id) { > $this->Session->setFlash(__('Invalid post', true)); > $this->redirect(array('action' => 'index')); > } > > $post = $this->set('post', $this->Post->read(null, $id)); > $this->theme = 'jonlyles'; > > if(Inflector::slug($post['Post']['title']) != > $this->params['pass'][1] || count($this->params['pass']) != 2 ) { > > $post = $this->Post->read(null, $id); > $this->redirect(array($id, Inflector::slug($post['Post'] > ['title']), 301)); > } > } > > If I remove the last if condition there are no errors, but then no > protection against bad urls either. 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 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
Re: redirect loop has me stumped
Ok sorry. Here's a more full explanation: In my index.ctp I have links that look like this: Html->link($post['Post']['title'], array('controller' => 'posts', 'action' => 'view', $post['Post']['id'],Inflector::slug($post['Post'] ['title'], '-'))); ?> Then in the PostsController view() method, this is what it looks like: function view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid post', true)); $this->redirect(array('action' => 'index')); } $post = $this->set('post', $this->Post->read(null, $id)); $this->theme = 'jonlyles'; if(Inflector::slug($post['Post']['title']) != $this- >params['pass'][1] || count($this->params['pass']) != 2 ) { $post = $this->Post->read(null, $id); $this->redirect(array($id, Inflector::slug($post['Post'] ['title']), 301)); } } If I remove the last if condition there are no errors, but then no protection against bad urls either. 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 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
Re: redirect loop has me stumped
I'm guessing there is more to the problem than the code you're presenting. Like, where is $id coming from? 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 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
redirect loop has me stumped
Hi Everyone, I need some help with a redirect loop... Consider the following code (from Super Advanced CakePHP tips page 43-44 http://www.scribd.com/doc/19344870/Super-Awesome-Advanced-CakePHP-Tips) if(Inflector::slug($post['Post']['title']) != $this->params['pass'] [1] || count($this->params['pass']) != 2 ) { $post = $this->Post->read(null, $id); $this->redirect(array($id, Inflector::slug($post['Post'] ['title']), 301)); } } Any ideas why this would cause a redirect loop? 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 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
Re: Auth Login redirect loop
On Jun 18, 8:14 am, Hatori Nakumora wrote: > Hi Guys, > > I'm using CakePhp 1.3 and the Auth component. > > Heres my setup for the beforeFilter in the app_controller.php > > function beforeFilter() { > if (isset($this->params['requested'])) $this->Auth- > > >allow($this->action); > > $this->Auth->userModel = 'Applicant'; > $this->Auth->fields = array('username' => 'email', 'password' > => 'password'); > $this->Auth->loginAction = array('admin' => false, > 'controller' => 'applicants', 'action' => 'login'); > $this->Auth->loginRedirect = array('controller' => > 'applicants', 'action' => 'profile'); > $this->Auth->authorize = 'controller'; > $this->Auth->autoRedirect = false; > } > > Here's the applicants_controller.php > > function beforeFilter() { > > parent::beforeFilter(); > $this->Auth->allow(array('login', 'logout')); > > } Don't include login action here as it causes problems for Auth. The login action is special and Auth takes care of allowing it. But, besides that, I see that you have set autoRedirect to false. Do you also have some logic in your login() method? Does anyone else think that Auth::allow() should simply ignore 'login' if it's passed? It seems a bit absurd that this action name should be so troublesome. It should be trivial to add some code to check if it was passed in. 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 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
Auth Login redirect loop
Hi Guys, I'm using CakePhp 1.3 and the Auth component. Heres my setup for the beforeFilter in the app_controller.php function beforeFilter() { if (isset($this->params['requested'])) $this->Auth- >allow($this->action); $this->Auth->userModel = 'Applicant'; $this->Auth->fields = array('username' => 'email', 'password' => 'password'); $this->Auth->loginAction = array('admin' => false, 'controller' => 'applicants', 'action' => 'login'); $this->Auth->loginRedirect = array('controller' => 'applicants', 'action' => 'profile'); $this->Auth->authorize = 'controller'; $this->Auth->autoRedirect = false; } Here's the applicants_controller.php function beforeFilter() { parent::beforeFilter(); $this->Auth->allow(array('login', 'logout')); } I could access the login page on /applicants/login, but when you submit the login form with a correct login details a redirect loop occurs. But you could access the others functions when you've type the url manually on the browser. Here's the log on the applicants controller's beforeFilters : 2010-06-18 20:09:45 Debug: Here: /jobs/applicants/login, coming from: / applicants/login 2010-06-18 20:09:46 Debug: Here: /jobs/applicants/login, coming from: / applicants/login 2010-06-18 20:09:46 Debug: Here: /jobs/applicants/login, coming from: / applicants/login 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 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
Re: BeforeFilter Redirect Loop
You have to make sure that the beforeFilter method allows the user to access /admin/index! So add a check that if it is admin/index, then do not redirect :) Enjoy, John On Jan 16, 2:45 pm, Uresh wrote: > hi, > I am beginner in cakephp. > I made controller and i want to apply "Beforefilter()" , > which checks every time when controller/action calls. > > i write beforefilter() in my controller and checking if session is exist and > username is set or not. > > function beforefilter() > { > $username = $this->Session->read('UserProfile'); > > if (!$username){ > > > $this->redirect(array('controller'=>'admin','action'=>'index')); > } > > } > > but every time code run and gives "REDIRECT LOOP" and hang. > -- > View this message in > context:http://old.nabble.com/BeforeFilter-Redirect-Loop-tp27189033p27189033 > Sent from the CakePHP mailing list archive at Nabble.com. 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 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
BeforeFilter Redirect Loop
hi, I am beginner in cakephp. I made controller and i want to apply "Beforefilter()" , which checks every time when controller/action calls. i write beforefilter() in my controller and checking if session is exist and username is set or not. function beforefilter() { $username = $this->Session->read('UserProfile'); if (!$username){ $this->redirect(array('controller'=>'admin','action'=>'index')); } } but every time code run and gives "REDIRECT LOOP" and hang. -- View this message in context: http://old.nabble.com/BeforeFilter-Redirect-Loop-tp27189033p27189033.html Sent from the CakePHP mailing list archive at Nabble.com. 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 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
Re: Redirect loop using Auth + Acl component
Thanks guys. I think I figured it out. I was using the Drayan's version of the phpThumb component from the bakery (http:// bakery.cakephp.org/articles/view/phpthumb-component). I found another post that says the phpThumb component should extent Object and not Component. I made that change and my redirect loops have disappeared. Can anyone tell me why? On Jul 1, 3:27 pm, NegoBlack® wrote: > I think that is not a good idea... I remeber to read in some place on > the docs that it was not recomended. Could you tell more about your > Auth system? > > On Jul 1, 9:03 am, GravyFace wrote: > > > Not sure about your code, but try adding > > $this->Auth->allow('login');http://book.cakephp.org/view/382/allow > > > On Wed, Jul 1, 2009 at 5:49 AM, Delberto wrote: > > > > Hello, > > > > I am building an application and am having an issue with one of my > > > controllers. I get the following message in Firefox > > > > "Redirection limit for this URL exceeded. Unable to load the > > > requested page. This may be caused by cookies that are blocked" > > > > I have followed the cookbook tutorial Simple Acl controlled > > > Application. I haven't got this error on my other controllers so I'm > > > wondering what has gone wrong. The error is intermittent but it is a > > > bit of a show stopper. > > > > Any help you can give would be gratefully received. > > > > Best Regards, > > > Derek --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Redirect loop using Auth + Acl component
I think that is not a good idea... I remeber to read in some place on the docs that it was not recomended. Could you tell more about your Auth system? On Jul 1, 9:03 am, GravyFace wrote: > Not sure about your code, but try adding > $this->Auth->allow('login');http://book.cakephp.org/view/382/allow > > On Wed, Jul 1, 2009 at 5:49 AM, Delberto wrote: > > > Hello, > > > I am building an application and am having an issue with one of my > > controllers. I get the following message in Firefox > > > "Redirection limit for this URL exceeded. Unable to load the > > requested page. This may be caused by cookies that are blocked" > > > I have followed the cookbook tutorial Simple Acl controlled > > Application. I haven't got this error on my other controllers so I'm > > wondering what has gone wrong. The error is intermittent but it is a > > bit of a show stopper. > > > Any help you can give would be gratefully received. > > > Best Regards, > > Derek --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Redirect loop using Auth + Acl component
Not sure about your code, but try adding $this->Auth->allow('login'); http://book.cakephp.org/view/382/allow On Wed, Jul 1, 2009 at 5:49 AM, Delberto wrote: > > Hello, > > I am building an application and am having an issue with one of my > controllers. I get the following message in Firefox > > "Redirection limit for this URL exceeded. Unable to load the > requested page. This may be caused by cookies that are blocked" > > I have followed the cookbook tutorial Simple Acl controlled > Application. I haven't got this error on my other controllers so I'm > wondering what has gone wrong. The error is intermittent but it is a > bit of a show stopper. > > Any help you can give would be gratefully received. > > Best Regards, > Derek > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Redirect loop using Auth + Acl component
Hello, I am building an application and am having an issue with one of my controllers. I get the following message in Firefox "Redirection limit for this URL exceeded. Unable to load the requested page. This may be caused by cookies that are blocked" I have followed the cookbook tutorial Simple Acl controlled Application. I haven't got this error on my other controllers so I'm wondering what has gone wrong. The error is intermittent but it is a bit of a show stopper. Any help you can give would be gratefully received. Best Regards, Derek --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Redirect Loop
Since someone emailed me off the list to inquire about this, I thought I'd post my fix for the problem for those who find this in the future. Here's what I wrote in my email: It turned out that I had moved some code in the layout that was trying to check against Auth. I have this code in my app_controller.php file: function beforeFilter(){ if ($role = $this->Auth->user('role')) { $this->set('user_info', $this->Auth->user()); } } I check for that $user_info variable in the layout. I'm not sure exactly what caused the problem but I'm pretty sure that was the root of it. Here's what the layout has: if (isset($user_info)) { // display the username and some other info } I was modifying the layout and put that part of the code at the very beginning. The effect was that the code was run before the page could be rendered so that even when I went to log in, it was being checked, thus trying to redirect me toward the login page. I think it went something like this: 1. I tried to access a page that was protected by Auth. 2. I was redirected to the login page 3. The login page tried to check for $user_info which wasn't set because I hadn't logged in. Since it was checking before the page rendered, it kept redirecting without ever rendering the page until Firefox decided that it was an infinite loop (it was) and stopped trying. At least I think that's what was happening. As soon as I moved that section down into a part of the page that would be run after the page started to render, it solved my problem. It was bizarre. You wouldn't think that modifying a layout would send the application into an infinite loop. In retrospect it makes sense if my understanding of the problem is correct. In any case, the problem was solved. On Mar 11, 4:07 pm, Tony Thomas wrote: > I've been working on a local copy of my CakePHP app that runs on a my > computer. Today I've only been working on a layout and the style > sheet. I took a break and went back to it which prompted a new login. > Suddenly I'm getting aredirectloop. Firefox gives me this following > message: > > RedirectLoop > > Firefox has detected that the server is redirecting the request for > this address in a way that will never complete. > > The browser has stopped trying to retrieve the requested item. The > site is redirecting the request in a way that will never complete. > > * Have you disabled or blocked cookies required by this site? > * NOTE: If accepting the site's cookies does not resolve the > problem, it is likely a server configuration issue and not your > computer. > > Any thoughts on what might cause that if I wasn't working in the a > controller? More importantly, how do I fix it? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Redirect Loop
I've been working on a local copy of my CakePHP app that runs on a my computer. Today I've only been working on a layout and the style sheet. I took a break and went back to it which prompted a new login. Suddenly I'm getting a redirect loop. Firefox gives me this following message: Redirect Loop Firefox has detected that the server is redirecting the request for this address in a way that will never complete. The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete. * Have you disabled or blocked cookies required by this site? * NOTE: If accepting the site's cookies does not resolve the problem, it is likely a server configuration issue and not your computer. Any thoughts on what might cause that if I wasn't working in the a controller? More importantly, how do I fix it? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth + Custom Login + isAuthorized = Infinite Redirect Loop
Nevermind everyone. I was being an idiot. My loginRedirect was to a place that required authorization. As soon as I changed it some a general controller and action that ALL loggged in users had access to, I was fine. On Jun 18, 8:46 am, Baz L <[EMAIL PROTECTED]> wrote: > I believe I'm having a similar problem as > :http://groups.google.com/group/cake-php/browse_thread/thread/6d672c98... > > I'm using controller authorization, so there is a isAuthorized() in my > app_controller.php which goes off of a simple $this->Auth- > > >user('role'). > > I'm pretty much working off of the examples in the Cook > Book:http://book.cakephp.org/view/172/authentication > > I have the same login() function. > > This is what I've noticed. > After isAuthorized returns false (user logs in, but is not authorized) > I get redirected to: > $controller->redirect($this->noaccessRedirect, null, true); (from > Auth::isAuthorized() ) > This sends me back to my login page (which is fine), however (and I'm > assuming here) Auth::startup gets called again, thus > Auth::isAuthorized() gets called again, and the whole thing starts > over and over again. > > If I clear out the UsersController::login(), then every thing works > fine. > > Can someone with more experiece help me out, or do I submit a ticket. > > Any help would be appreciated. > -- > Baz L > Web Development 2.0http://WebDevelopment2.com/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Auth + Custom Login + isAuthorized = Infinite Redirect Loop
I believe I'm having a similar problem as : http://groups.google.com/group/cake-php/browse_thread/thread/6d672c98ae0557d5/c07ecd162209eab7 I'm using controller authorization, so there is a isAuthorized() in my app_controller.php which goes off of a simple $this->Auth- >user('role'). I'm pretty much working off of the examples in the Cook Book: http://book.cakephp.org/view/172/authentication I have the same login() function. This is what I've noticed. After isAuthorized returns false (user logs in, but is not authorized) I get redirected to: $controller->redirect($this->noaccessRedirect, null, true); (from Auth::isAuthorized() ) This sends me back to my login page (which is fine), however (and I'm assuming here) Auth::startup gets called again, thus Auth::isAuthorized() gets called again, and the whole thing starts over and over again. If I clear out the UsersController::login(), then every thing works fine. Can someone with more experiece help me out, or do I submit a ticket. Any help would be appreciated. -- Baz L Web Development 2.0 http://WebDevelopment2.com/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Cakephp 1.2 AuthComponent Redirect Loop
Hi, I've followed through several AuthComponent tutorials and found http://myeasyscripts.com/loudbaking/how-to-use-authcomponent-in-cakephp/ to be to my liking as it has a nice implementation that makes code in each controller very easy to use to allow/deny access. I've gotten it to work as far as registering new users, doing a login and redirection to a page (non-protected). But from there whenever I try to access a protected page I get an infinite redirect and my page never resolves. This is my current app_controller.php http://pastebin.com/f5e71c181 I've tried changing around some configuration of the autoRedirect and the loginRedirect but nothing seems to solve my problem. So hopefully someone can help me out with this, thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---