Re: Auth Problems
Now I used the Code from http://book.cakephp.org/view/1250/Authentication but every time I get an Error: Warning (2): Cannot modify header information - headers already sent by (output started at C:\xampp\xampplite\htdocs\cakephp\cake\libs \debugger.php:673) [CORE\cake\libs\controller\controller.php, line 742] Code | Context $status = Location: http://localhost/cakephp/; header - [internal], line ?? Controller::header() - CORE\cake\libs\controller\controller.php, line 742 Controller::redirect() - CORE\cake\libs\controller\controller.php, line 721 AuthComponent::startup() - CORE\cake\libs\controller\components \auth.php, line 375 Component::triggerCallback() - CORE\cake\libs\controller \component.php, line 186 Controller::startupProcess() - CORE\cake\libs\controller \controller.php, line 523 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 187 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171 [main] - APP\webroot\index.php, line 83 On 1 Mrz., 16:11, Ryan Schmidt google-2...@ryandesign.com wrote: On Mar 1, 2011, at 03:02, Dreknor wrote: Notice (8): Use of undefined constant VALID_NOT_EMPTY - assumed 'VALID_NOT_EMPTY' [CORE\cake\libs\class_registry.php, line 141] Notice (8): Use of undefined constant VALID_EMAIL - assumed 'VALID_EMAIL' [CORE\cake\libs\class_registry.php, line 141] You must've been following an old CakePHP 1.2.x tutorial; these were removed in CakePHP 1.3. Instead of VALID_NOT_EMPTY, read about notEmpty: http://book.cakephp.org/view/740/notEmpty Instead of VALID_EMAIL, read about email: http://book.cakephp.org/view/1161/email Notice (1024): Please change the value of 'Security.salt' in app/ config/core.php to a salt value specific to your application [CORE\cake \libs\debugger.php, line 684] Notice (1024): Please change the value of 'Security.cipherSeed' in app/ config/core.php to a numeric (digits only) seed value specific to your application [CORE\cake\libs\debugger.php, line 688] Please do those things that the error messages say to do. See also: http://book.cakephp.org/view/924/The-Configuration-Class#CakePHP-Core... -- 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: Auth Problems
On Mar 1, 2011, at 03:02, Dreknor wrote: Notice (8): Use of undefined constant VALID_NOT_EMPTY - assumed 'VALID_NOT_EMPTY' [CORE\cake\libs\class_registry.php, line 141] Notice (8): Use of undefined constant VALID_EMAIL - assumed 'VALID_EMAIL' [CORE\cake\libs\class_registry.php, line 141] You must've been following an old CakePHP 1.2.x tutorial; these were removed in CakePHP 1.3. Instead of VALID_NOT_EMPTY, read about notEmpty: http://book.cakephp.org/view/740/notEmpty Instead of VALID_EMAIL, read about email: http://book.cakephp.org/view/1161/email Notice (1024): Please change the value of 'Security.salt' in app/ config/core.php to a salt value specific to your application [CORE\cake \libs\debugger.php, line 684] Notice (1024): Please change the value of 'Security.cipherSeed' in app/ config/core.php to a numeric (digits only) seed value specific to your application [CORE\cake\libs\debugger.php, line 688] Please do those things that the error messages say to do. See also: http://book.cakephp.org/view/924/The-Configuration-Class#CakePHP-Core-Configuration-Variables-931 -- 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: Auth Problems
In my 'Users' controller I do this: beforeFilter() { $this-Auth-allow(array('logout') ); parent::beforeFilter(); } function login() {} function logout() { $this-Auth-logout(); $this-flash(You are now logged out of the site., '/' ); } I don't know if this is correct, but it works. -Aran On May 10, 2:07 pm, Greg [EMAIL PROTECTED] wrote: Hi, I'm having several, probably related, problems with the Auth class. First of all, I'm a Cake noob but I've been searching for answers and have finally resorted to posting. My app requires authentication before access to any controller/action. On my shared server I can't use 'users' or 'admin' URI segments because they are used for hosting account management. Therefore in app_controller I have created an 'Account' model for Auth. My app_controller looks like this: [code] ?php class AppController extends Controller { var $components = array('Auth'); function beforeFilter() { $this-Auth-userModel = 'Account'; $this-Auth-loginAction = array('controller' = 'accounts', 'action' = 'login'); $this-Auth-logoutRedirect = array('controller' = 'accounts', 'action' = 'login'); } } ? [/code] I have the login and logout functions from the manual in my accounts controller. On trying to access any page I get redirected to /accounts/ login, which is what I expect to happen. However, if I try to logout, say at /accounts/logout, then instead of being redirected to /accounts/ login I'm being redirected to /users/logout, which of course causes a 404. I suspect I may not fully understand how Auth is supposed to work but what have I done wrong here? Cheers --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
Hi, thanks for taking the time to reply. I tried to add your example to my Account controller but that did not work. I had an existing Auth- allow array that was: $this-Auth-allow('login', 'index') I was trying different possibilities. In the end I removed it completely and now it's working ok! I saw another post that mentioned having 'login' in the allowed array could cause problems. Perhaps that was the issue. Cheers --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
On Sun, May 11, 2008 at 11:38 AM, Greg [EMAIL PROTECTED] wrote: Hi, thanks for taking the time to reply. I tried to add your example to my Account controller but that did not work. I had an existing Auth- allow array that was: $this-Auth-allow('login', 'index') I was trying different possibilities. In the end I removed it completely and now it's working ok! I saw another post that mentioned having 'login' in the allowed array could cause problems. Perhaps that was the issue. Yeah, you don't need to put 'login' in $this-Auth-allow(...) as Auth handles that automatically. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard: http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
Here's a shameless plug for my site: http://www.webdevelopment2.com/cakephp-auth-component-tutorial-2/ There's some sample code you can download there and compare certain things. On Feb 11, 2008 1:21 PM, Chris Hartjes [EMAIL PROTECTED] wrote: On Feb 11, 2008 2:05 PM, Neil [EMAIL PROTECTED] wrote: Thanks, but that is not the problem then because in my current setup for testing I put var $components = array('Auth'); in every controller instead of app_controller and it still did not work. Dude, I have no idea why it's not working for you. All the advice you've been given is enough to get you going. Here's a handy checklist that I use when doing Auth 1) Have I included the component everywhere I want 2) Have I created the database for the model I'm using for Auth 3) Have I created the Model for the database I'm using for Auth 4) Have I created my login action and view 5) Have I set the correct parameters in my beforeFilter() depending on my particular scenario 6) I have read over some of these fine sources of documentation on using Auth (I happened to have written them): http://tempdocs.cakephp.org/#TOC14 http://www.littlehart.net/atthekeyboard/?s=Auth If you've gone through all that and *still* can't get it to work, well, you've fucked something up and need to really debug stuff. Yes, I've made mistakes too despite all the fine info listed above but I always figure it out in the end. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard: http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
Thanks, but that is not the problem then because in my current setup for testing I put var $components = array('Auth'); in every controller instead of app_controller and it still did not work. On Feb 11, 2:01 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On Feb 11, 2008 1:59 PM, Neil [EMAIL PROTECTED] wrote: thanks for the quick reply. what does: parrent::beforeFilter(); do? thanks! It executes anything that is in the beforeFilter() method of the parent class. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
On Feb 11, 2008 1:59 PM, Neil [EMAIL PROTECTED] wrote: thanks for the quick reply. what does: parrent::beforeFilter(); do? thanks! It executes anything that is in the beforeFilter() method of the parent class. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard: http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
thanks for the quick reply. what does: parrent::beforeFilter(); do? thanks! On Feb 11, 1:42 pm, Baz [EMAIL PROTECTED] wrote: In your controllers, shouldn't you have: function beforeFilter() { parrent::beforeFilter(); $this-Auth-allow('action1', 'action2', ect..); } On Feb 11, 2008 12:38 PM, Neil [EMAIL PROTECTED] wrote: I still can't get this to work: I have added this to my app controler: var $components = array('Auth'); and then to all my other controllers where I want to allow access to certain cations I did: function beforeFilter() { $this-Auth-allow('action1', 'action2', ect..); } It appears to work when I first set it up but then if I check back 1-2hrs later nothing work and I get the error I shared with you in my last reply. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
I still can't get this to work: I have added this to my app controler: var $components = array('Auth'); and then to all my other controllers where I want to allow access to certain cations I did: function beforeFilter() { $this-Auth-allow('action1', 'action2', ect..); } It appears to work when I first set it up but then if I check back 1-2hrs later nothing work and I get the error I shared with you in my last reply. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
On Feb 11, 2008 2:05 PM, Neil [EMAIL PROTECTED] wrote: Thanks, but that is not the problem then because in my current setup for testing I put var $components = array('Auth'); in every controller instead of app_controller and it still did not work. Dude, I have no idea why it's not working for you. All the advice you've been given is enough to get you going. Here's a handy checklist that I use when doing Auth 1) Have I included the component everywhere I want 2) Have I created the database for the model I'm using for Auth 3) Have I created the Model for the database I'm using for Auth 4) Have I created my login action and view 5) Have I set the correct parameters in my beforeFilter() depending on my particular scenario 6) I have read over some of these fine sources of documentation on using Auth (I happened to have written them): http://tempdocs.cakephp.org/#TOC14 http://www.littlehart.net/atthekeyboard/?s=Auth If you've gone through all that and *still* can't get it to work, well, you've fucked something up and need to really debug stuff. Yes, I've made mistakes too despite all the fine info listed above but I always figure it out in the end. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard: http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
In your controllers, shouldn't you have: function beforeFilter() { parrent::beforeFilter(); $this-Auth-allow('action1', 'action2', ect..); } On Feb 11, 2008 12:38 PM, Neil [EMAIL PROTECTED] wrote: I still can't get this to work: I have added this to my app controler: var $components = array('Auth'); and then to all my other controllers where I want to allow access to certain cations I did: function beforeFilter() { $this-Auth-allow('action1', 'action2', ect..); } It appears to work when I first set it up but then if I check back 1-2hrs later nothing work and I get the error I shared with you in my last reply. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
Also, it is important to note under which mode you are using Auth. For example, I am using 'actions' mode alongside the AclComponent. In this case, I use the following: function beforeFilter() { $this-Auth-allowedActions = array('reset_password'); parent::beforeFilter(); } On Feb 11, 11:27 am, Baz [EMAIL PROTECTED] wrote: Here's a shameless plug for my site: http://www.webdevelopment2.com/cakephp-auth-component-tutorial-2/ There's some sample code you can download there and compare certain things. On Feb 11, 2008 1:21 PM, Chris Hartjes [EMAIL PROTECTED] wrote: On Feb 11, 2008 2:05 PM, Neil [EMAIL PROTECTED] wrote: Thanks, but that is not the problem then because in my current setup for testing I put var $components = array('Auth'); in every controller instead of app_controller and it still did not work. Dude, I have no idea why it's not working for you. All the advice you've been given is enough to get you going. Here's a handy checklist that I use when doing Auth 1) Have I included the component everywhere I want 2) Have I created the database for the model I'm using for Auth 3) Have I created the Model for the database I'm using for Auth 4) Have I created my login action and view 5) Have I set the correct parameters in my beforeFilter() depending on my particular scenario 6) I have read over some of these fine sources of documentation on using Auth (I happened to have written them): http://tempdocs.cakephp.org/#TOC14 http://www.littlehart.net/atthekeyboard/?s=Auth If you've gone through all that and *still* can't get it to work, well, you've fucked something up and need to really debug stuff. Yes, I've made mistakes too despite all the fine info listed above but I always figure it out in the end. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
Here is how I solve this problem: if (isset($this-params[Configure::read('Routing.admin')])) $this-Auth-allow( ); else { if ($this-action != login $this-action != logout) //put here any actions you want to deny access to $this-Auth-allow($this-action); } On Feb 9, 3:01 am, Chris Hartjes [EMAIL PROTECTED] wrote: On Feb 8, 2008 7:57 PM, Neil [EMAIL PROTECTED] wrote: $this-Auth-allow('action1', 'action2', 'action3') vs $this-Auth-allow('login'); whats the difference? The difference is that the Auth component automatically allows you to access an action called 'login'. If you do $this-Auth-allow('login'), I can 100% guarantee that things will not work properly. $this-Auth-allow(...) specifies what actions you do not want to be protected by authentication. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
On Feb 8, 2008 7:57 PM, Neil [EMAIL PROTECTED] wrote: $this-Auth-allow('action1', 'action2', 'action3') vs $this-Auth-allow('login'); whats the difference? The difference is that the Auth component automatically allows you to access an action called 'login'. If you do $this-Auth-allow('login'), I can 100% guarantee that things will not work properly. $this-Auth-allow(...) specifies what actions you do not want to be protected by authentication. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard: http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
ok thanks for the info! I changed that error however my site still is not working. in all my controllers I have: var $components = array('Auth'); and then when ever I want an action to work without Authentication i put: function beforeFilter() { $this-Auth-allow('action1', 'action2', 'ect...'); } any clue why this is not working? I am not able to access any pages On Feb 8, 8:01 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On Feb 8, 2008 7:57 PM, Neil [EMAIL PROTECTED] wrote: $this-Auth-allow('action1', 'action2', 'action3') vs $this-Auth-allow('login'); whats the difference? The difference is that the Auth component automatically allows you to access an action called 'login'. If you do $this-Auth-allow('login'), I can 100% guarantee that things will not work properly. $this-Auth-allow(...) specifies what actions you do not want to be protected by authentication. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
this is the error I am getting: The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. * This problem can sometimes be caused by disabling or refusing to accept cookies. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Problems
I think you'll need to post you app_controller code (as pertains to auth) you may have some info in the debug file On 09/02/2008, Neil [EMAIL PROTECTED] wrote: this is the error I am getting: The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. * This problem can sometimes be caused by disabling or refusing to accept cookies. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---