Auth component with Logins model
Hello, I have made a Logins table separate from the Users table. I have changed 'authenticate' => [ 'Basic' => [ 'userModel' => 'Logins' ], ] It works the only problem i have is that the session doesnt get destroyed. I have destroyed it and it shows nothing but something keeps writing the data back to the session. Does somebody know what it is. unset($_SESSION); return $this->redirect($this->Auth->logout()); I do this and i see that the superglobals Session variable is getting changed and the Auth.User is getting removed but at the end of the script something writes it back. -- Sign up for our Newsletter for updates. http://cakephp.org/newsletter/signup We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon. Like Us on FaceBook https://www.facebook.com/CakePHP Follow us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Auth Component works in dev, but not in production
compartenos los log y debugs. Enviado con MailTrack <https://mailtrack.io/install?source=signature=es=christian.quis...@gmail.com=23> Saludos Christian Quispe *Geek and Developer* *Miembro: * *GDG Lima (Google Developer Group Lima)* *Portafolio: www.oxicode.io <https://mailtrack.io/trace/link/952a2558655197cbecf24d3fefe8846fe06919f9?url=http%3A%2F%2Foxicode.io=73f61100d6aa58de>* *¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores constantemente...* 2016-01-20 4:58 GMT-05:00 Ricardo Escalon <ricardo.esca...@gmail.com>: > I am getting a blank page when I try and use the Auth Component. > > The code is straight out of the blog tutorial. > > > http://book.cakephp.org/3.0/en/tutorials-and-examples/blog-auth-example/auth.html > > It works in dev, but I get a blank page in production. > > Any ideas anyone? > > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at https://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at https://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Auth Component works in dev, but not in production
I am getting a blank page when I try and use the Auth Component. The code is straight out of the blog tutorial. http://book.cakephp.org/3.0/en/tutorials-and-examples/blog-auth-example/auth.html It works in dev, but I get a blank page in production. Any ideas anyone? -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at https://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Auth Component Logout renews Session
public function logout() { - $this-Session-renew(); } See Above code at AuthComponent::logout, my question is why it renews the session on logout. Problem Case: When user open a page with Auth login/logout in incognito browser window. Then *upon logout there will always be a orphan session* entry in cake_sessions table or an unused file in /tmp/sessions/. Is this OK ? -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Mock auth component in controller test using testAction
Is _apiLoginRequest() a static method? On Tuesday, April 7, 2015 at 1:06:15 PM UTC+2, Sebastian Bergquist wrote: Hi! I’m having some problems with my tests. I can’t seem to mock the auth component in a controller test using the testAction method… Here are the part of the test that causes the problem: https://gist.github.com/beez/6f9ee89538d1a6be6dfb Any help or pointers on how to solve this is greatly appreciated! -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Mock auth component in controller test using testAction
Hi! I’m having some problems with my tests. I can’t seem to mock the auth component in a controller test using the testAction method… Here are the part of the test that causes the problem: https://gist.github.com/beez/6f9ee89538d1a6be6dfb Any help or pointers on how to solve this is greatly appreciated! -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
logout a specific user using the Auth Component
Hi, Sorry for my bad english :( I want to logout a specific user (not the logged one) using the cakephp Auth Component but the logout method doesn't accept any param !! is there any alternative way to specify the ID of the user that we want to logout ? thanks -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Auth Component
I've been hitting my head over this for quite some time now. When I login using the Auth Component as such: $this-Auth-login() It will login just fine and define the following authUser: User User.Person User.Company But when I login in another situation like so: $this-Auth-login($user['User']) This will log them in just fine, but define the following authUser: User * Without User.Person or User.Company Does anyone know why this is? How can I get the same behavior across the board? I would like he User.Person and User.Company in both instances. Thanks in advance. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Auth Component
What happens if, when you define $user, you also include (contain?) the Person and Company models and log in with that $user variable? On 27 Jun 2014, at 00:57, Matt Myers spartac...@gmail.com wrote: I've been hitting my head over this for quite some time now. When I login using the Auth Component as such: $this-Auth-login() It will login just fine and define the following authUser: User User.Person User.Company But when I login in another situation like so: $this-Auth-login($user['User']) This will log them in just fine, but define the following authUser: User * Without User.Person or User.Company Does anyone know why this is? How can I get the same behavior across the board? I would like he User.Person and User.Company in both instances. Thanks in advance. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
RE: Auth Component
Hi Matt, You can check array $user['User'], there is company and person found? After that we will check more. Regards Saran -Original Message- From: Matt Myers spartac...@gmail.com Sent: 27-06-2014 12:46 PM To: cake-php@googlegroups.com cake-php@googlegroups.com Subject: Auth Component I've been hitting my head over this for quite some time now. When I login using the Auth Component as such: $this-Auth-login() It will login just fine and define the following authUser: User User.Person User.Company But when I login in another situation like so: $this-Auth-login($user['User']) This will log them in just fine, but define the following authUser: User * Without User.Person or User.Company Does anyone know why this is? How can I get the same behavior across the board? I would like he User.Person and User.Company in both instances. Thanks in advance. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Help! Auth Component in Lib directory
Hi all, I'm struggling getting this code working, wondering if anyone had any insights I've written an application that has a lot of web services, It used Zend to create a server and loads classes from my lib folder So my structure is like this: app/Controller/WebServicesController.php app/Lib/WebServices/SomeService.php The controller loads the requested service and passes it as an argument to the Zend SOAP server code. It works fine, except where I need the response from the Auth Component. I want a partner site to be able to validate a username/password as part of a unified login. So if a user tries logging in to site X, that site will call my web service with the username and password and return the result of Auth:identify. This is the relevant code in my SomeService.php file, I've attempted to initialize the Auth Component as I do in the standard login procedure, but it ALWAYS returns false, even if the credentials are correct: function check_credentials($username, $password) { $userObj = new CakeRequest(); $userObj-data['User'] = array('username'=$username, 'password'=$password); $resp = new CakeResponse(); App::import('Component', 'Auth'); $Auth = new AuthComponent(new ComponentCollection()); $Auth::initialize(); $Auth-authenticate = array( 'all' = array('userModel' = 'User'), ); $result = $Auth-identify($userArr,$resp); return $result; } Any help would be greatly appreciated! -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Help! Auth Component in Lib directory
Can't edit my first post, so just be aware that this line: $result = $Auth-identify($userArr,$resp); should be : $result = $Auth-identify($userObj,$resp); And I'm using Cake 2.4.4 -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Auth component problem.
Hello there, i have an issue with Auth.redirect value. on my local machine when i do in my view: debug($this-Session-read('Auth.redirect')); result is: 'users/register.html' the same app on remote server gives me this output. 'users/register.html?url=users%2Fregister.html' why is the ?url part appended to the redirect value on remote server ? Does it have something to do with remote server config ? i'm using latest CakePHP 2.4.2 many thank for your help. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Using Auth component with two different models
On Tue, Apr 23, 2013 at 7:26 PM, André Luis cavall...@live.com wrote: I suggest to use a single model and separate the users using groups... Thanks André - best plan I think. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Using Auth component with two different models
set the userModel and set $sessionKey as $sessionKey = 'Auth.YourModelName'; then you can separate your log-in sessions and login with models respectively. 2013/4/23 Alex Bovey a...@bovey.co.uk On Fri, Apr 19, 2013 at 4:39 PM, Alex Bovey a...@bovey.co.uk wrote: Hi all, What's the best technique to use if I have two separate areas of my site and I want the Auth component to use two separate models to log in to those areas? I have tried setting the $this-Auth-authenticate['Form']['userModel'] from the controller but that doesn't seem to have any effect... Hi all - any thoughts on this one? Thanks! Alex -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Using Auth component with two different models
sorry, let me correct, it should be: AuthComponent::$sessionKey = 'Auth.YourModelName'; 2013/4/23 Irvin Huang tfir...@gmail.com set the userModel and set $sessionKey as $sessionKey = 'Auth.YourModelName'; then you can separate your log-in sessions and login with models respectively. 2013/4/23 Alex Bovey a...@bovey.co.uk On Fri, Apr 19, 2013 at 4:39 PM, Alex Bovey a...@bovey.co.uk wrote: Hi all, What's the best technique to use if I have two separate areas of my site and I want the Auth component to use two separate models to log in to those areas? I have tried setting the $this-Auth-authenticate['Form']['userModel'] from the controller but that doesn't seem to have any effect... Hi all - any thoughts on this one? Thanks! Alex -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Using Auth component with two different models
On Fri, Apr 19, 2013 at 4:39 PM, Alex Bovey a...@bovey.co.uk wrote: Hi all, What's the best technique to use if I have two separate areas of my site and I want the Auth component to use two separate models to log in to those areas? I have tried setting the $this-Auth-authenticate['Form']['userModel'] from the controller but that doesn't seem to have any effect... Hi all - any thoughts on this one? Thanks! Alex -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Using Auth component with two different models
I suggest to use a single model and separate the users using groups... Em sexta-feira, 19 de abril de 2013 12h39min38s UTC-3, Alex Bovey escreveu: Hi all, What's the best technique to use if I have two separate areas of my site and I want the Auth component to use two separate models to log in to those areas? I have tried setting the $this-Auth-authenticate['Form']['userModel'] from the controller but that doesn't seem to have any effect... Thanks all, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England Wales no. 6471391 | VAT no. 934 8959 65 al...@bovey.co.uk javascript: | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533 PHP | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Using Auth component with two different models
Hi all, What's the best technique to use if I have two separate areas of my site and I want the Auth component to use two separate models to log in to those areas? I have tried setting the $this-Auth-authenticate['Form']['userModel'] from the controller but that doesn't seem to have any effect... Thanks all, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England Wales no. 6471391 | VAT no. 934 8959 65 a...@bovey.co.uk | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533 PHP | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Auth Component Issues
Ramon, Which CakePHP's version are you using? On Monday, April 1, 2013 4:55:32 PM UTC-3, Ramon José Silva wrote: Hi guys. Well, I trying to use the CakePHP on my own project, but I have a problem with the Auth Component. I'm not using the password hash yet and not using the UsersController and User Model, but I using Admin Model, AdminController and an Ajax, passing the form data to the controller login method, but I can't login in my system, the Auth always return false. I read the Docs trying to find something that's help me, and saw in the Auth part that I can personalized my form fields and tables to passing the data and everything works fine, but it not work for me. If I use: $this-data = array() and passing all data that I receive with Ajax to my Auth login, the login works fine, but not check if the User are subscribed on my DB. In the Docs have something about that, but with I try to login with the e-mail address and password that I registered, the Auth always return false even my User really exists in my DB. This is my AdminController: http://pastebin.com/AvQQf6iw, This is my App Controller: http://pastebin.com/B5XBwR5g, This is my Ajax: http://pastebin.com/kQV7taWQ Now, if I use in my login method this line: $query = $this-Admin-find('first', array('conditions' = array('admin_email' = $this-data['admin_email'], 'admin_pass' = $this-data['admin_pass']))); if($query == true){ echo 'true'; } else { echo 'Wrong User/Password'; } I really find the user. Can anyone help me with this? Thanks Guys for the help anyway. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Auth Component Issues
Hi Ramon, actually it´s not a issue, you said you´re not using a password hash, but the Auth system always use one to retrieve the user information, so when you try to use $this-Auth-login() it hashes the password before find on table, so you should hash it with AuthComponent::password() at model´s beforeSave to save the correct password on table... Em segunda-feira, 1 de abril de 2013 16h55min32s UTC-3, Ramon José Silva escreveu: Hi guys. Well, I trying to use the CakePHP on my own project, but I have a problem with the Auth Component. I'm not using the password hash yet and not using the UsersController and User Model, but I using Admin Model, AdminController and an Ajax, passing the form data to the controller login method, but I can't login in my system, the Auth always return false. I read the Docs trying to find something that's help me, and saw in the Auth part that I can personalized my form fields and tables to passing the data and everything works fine, but it not work for me. If I use: $this-data = array() and passing all data that I receive with Ajax to my Auth login, the login works fine, but not check if the User are subscribed on my DB. In the Docs have something about that, but with I try to login with the e-mail address and password that I registered, the Auth always return false even my User really exists in my DB. This is my AdminController: http://pastebin.com/AvQQf6iw, This is my App Controller: http://pastebin.com/B5XBwR5g, This is my Ajax: http://pastebin.com/kQV7taWQ Now, if I use in my login method this line: $query = $this-Admin-find('first', array('conditions' = array('admin_email' = $this-data['admin_email'], 'admin_pass' = $this-data['admin_pass']))); if($query == true){ echo 'true'; } else { echo 'Wrong User/Password'; } I really find the user. Can anyone help me with this? Thanks Guys for the help anyway. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Auth Component Issues
Hi guys. Well, I trying to use the CakePHP on my own project, but I have a problem with the Auth Component. I'm not using the password hash yet and not using the UsersController and User Model, but I using Admin Model, AdminController and an Ajax, passing the form data to the controller login method, but I can't login in my system, the Auth always return false. I read the Docs trying to find something that's help me, and saw in the Auth part that I can personalized my form fields and tables to passing the data and everything works fine, but it not work for me. If I use: $this-data = array() and passing all data that I receive with Ajax to my Auth login, the login works fine, but not check if the User are subscribed on my DB. In the Docs have something about that, but with I try to login with the e-mail address and password that I registered, the Auth always return false even my User really exists in my DB. This is my AdminController: http://pastebin.com/AvQQf6iw, This is my App Controller: http://pastebin.com/B5XBwR5g, This is my Ajax: http://pastebin.com/kQV7taWQ Now, if I use in my login method this line: $query = $this-Admin-find('first', array('conditions' = array('admin_email' = $this-data['admin_email'], 'admin_pass' = $this-data['admin_pass']))); if($query == true){ echo 'true'; } else { echo 'Wrong User/Password'; } I really find the user. Can anyone help me with this? Thanks Guys for the help anyway. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Auth Component; Strange behavior
Using Cake 2.2.5 My app is exhibiting a strange behavior in one of my controller/views. I have $this-Auth-allowedActions = array('view', 'index'); defined in the beforeFilter of one of my controllers. When an authenticated user navigates to the index view, Auth Component does not work on that page. Removing 'index' from allowedActions gets Auth Component working but then does not allow public access to that view. This is the only controller/view exhibiting this behavior, all others work fine. Any idea what could be going on here? - ED -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Auth Component; Strange behavior
Still learning Cake but maybe you have some code conflicting with auth on your AppController beforeFilter? Happened to me when trying out the Auth component. Pablo. On Monday, March 11, 2013 6:15:02 AM UTC-3, CrotchFrog wrote: Using Cake 2.2.5 My app is exhibiting a strange behavior in one of my controller/views. I have $this-Auth-allowedActions = array('view', 'index'); defined in the beforeFilter of one of my controllers. When an authenticated user navigates to the index view, Auth Component does not work on that page. Removing 'index' from allowedActions gets Auth Component working but then does not allow public access to that view. This is the only controller/view exhibiting this behavior, all others work fine. Any idea what could be going on here? - ED -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Auth Component; Strange behavior
Define Auth Component does not work. If Auth is allowing access then what else do you need? Could this be a routing issue? Are you using admin prefixes? (It's been a long day so I may well be missing something obvious here.) On Mon, Mar 11, 2013 at 5:15 AM, Ed Propsner crotchf...@gmail.com wrote: Using Cake 2.2.5 My app is exhibiting a strange behavior in one of my controller/views. I have $this-Auth-allowedActions = array('view', 'index'); defined in the beforeFilter of one of my controllers. When an authenticated user navigates to the index view, Auth Component does not work on that page. Removing 'index' from allowedActions gets Auth Component working but then does not allow public access to that view. This is the only controller/view exhibiting this behavior, all others work fine. Any idea what could be going on here? - ED -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Auth Component; Strange behavior
Pablito was correct, there was a conflict in my code. I had a custom helper to handle ckeditor and it was causing the conflict. On Monday, March 11, 2013 7:56:19 PM UTC-4, cricket wrote: Define Auth Component does not work. If Auth is allowing access then what else do you need? Could this be a routing issue? Are you using admin prefixes? (It's been a long day so I may well be missing something obvious here.) On Mon, Mar 11, 2013 at 5:15 AM, Ed Propsner crotc...@gmail.comjavascript: wrote: Using Cake 2.2.5 My app is exhibiting a strange behavior in one of my controller/views. I have $this-Auth-allowedActions = array('view', 'index'); defined in the beforeFilter of one of my controllers. When an authenticated user navigates to the index view, Auth Component does not work on that page. Removing 'index' from allowedActions gets Auth Component working but then does not allow public access to that view. This is the only controller/view exhibiting this behavior, all others work fine. Any idea what could be going on here? - ED -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+u...@googlegroups.com javascript:. To post to this group, send email to cake...@googlegroups.comjavascript:. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Auth component deleting Session data for no reason.
Hello cricket, its solved and fixed all above. Could you add me to gmail-chat? fortesgall...@gmail.com. Thanks you. El domingo, 6 de enero de 2013 23:32:35 UTC+1, cricket escribió: On Sat, Jan 5, 2013 at 3:08 PM, Pedro Fortes Gallego fortes...@gmail.com javascript: wrote: Is there any form to catch php fatal errors? Have a look at register_shutdown_function() i heard that if you left a blank space after ? tag, it can causes a fatal error. More likely it will cause the dreaded Headers already sent warning. That's because of the way that PHP buffers output. The charaters after the closing tags will be sent to the client immediately, so that when PHP tries to send the normal page headers out afterwards it will cause problems. The best solution for that is to leave out the ? in all your PHP files; it's not required. The interpreter will then deal with it correctly. -- 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: Auth component deleting Session data for no reason.
On Sat, Jan 5, 2013 at 3:08 PM, Pedro Fortes Gallego fortesgall...@gmail.com wrote: Is there any form to catch php fatal errors? Have a look at register_shutdown_function() i heard that if you left a blank space after ? tag, it can causes a fatal error. More likely it will cause the dreaded Headers already sent warning. That's because of the way that PHP buffers output. The charaters after the closing tags will be sent to the client immediately, so that when PHP tries to send the normal page headers out afterwards it will cause problems. The best solution for that is to leave out the ? in all your PHP files; it's not required. The interpreter will then deal with it correctly. -- 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: Auth component deleting Session data for no reason.
Hello, im solving that, thanks you very much. Is there any form to catch php fatal errors? i heard that if you left a blank space after ? tag, it can causes a fatal error. Trying yo depurate in local ... but im spending a lot of time in this stupid thing :( Thanks you for your time. El viernes, 4 de enero de 2013 03:50:30 UTC+1, cricket escribió: On Thu, Jan 3, 2013 at 6:02 AM, Pedro Fortes Gallego fortes...@gmail.com javascript: wrote: Hello, Im using auth component and cofiguring it in my AppController, just cake documentain say. class AppController extends Controller { ... public function beforeFilter() { $this-Auth-allow('login', 'index', 'forgotPassword'); This should be in the UsersController, not AppController. And you shouldn't include login in the allow() call. (I know, it's not intuitive.) white screen with no error and no debug info (trying debug to 2 - 3 and still no info). Im using a hoting, so its hard to access to apache log ... A white screen means a fatal PHP error, so Cake doesn't have the chance to log anything. Does your hosting account include an admin panel with access to the server logs? ?php class CategorysController extends AppController { It should be CategoriesController. public $helpers = array('Html', 'Form'); If these two helpers are commonly used you can put this in AppController and leave it out of all of your other controllers. public $uses = array ('Category', 'Sp', 'SpsSpsPart', 'SpsPart'); Are the Sp, SpsSpsPart, and SpsPart models associated with each other? And are any of them associated with Category? If so, you can remove this entire $uses var and chain your model calls like, eg. $this-Category-Sp-SpsPart-doSomething() But it doesn't even look like you're calling methods on those other classes, anyway. // public $components = array('Session', 'Auth'); This is not necessary here because you declared it in AppController, which is the parent of this controller. public function beforeFilter() { parent::beforeFilter(); $this-layout = 'login'; Are you sure you want the login layout for categories? public function addCategory ($sp, $spPart, $parent = 0) { if ($this-request-is('post')) { $this-Category-set($this-data); if ($this-Category-validates()) { $category = array ( 'sp_id' = $sp, 'parent_id' = $parent, 'sps_part_id' = $spPart, 'name' = $this-data['Category']['nombre'], 'l_name' = $this-data['Category']['nombrelatin'], 'description' = $this-data['Category']['descripcion'] ); You've got this a little bit backwards. public function add($sp_id, $sps_part_id, $parent_id = 0) { if ($this-request-is('post')) { $this-data['Category']['sp_id'] = $sp_id; $this-data['Category']['sps_part_id'] = $sps_part_id; $this-data['Category']['parent_id'] = $parent_id; // etc ... $this-Category-set($this-data); if ($this-Category-validates()) { if ($this-Category-save()) { Better: set the sp_id, sps_part_id, and parent_id as view variables and create hidden form fields for them. They'll be in the data array when it is submitted. public function showCategory ($sp, $spPart, $parent = null) { if ($parent == null) { $category = $this-Category-find('all', array ( 'fields' = array('Category.id', 'Category.sp_id', 'Category.parent_id', 'Category.sps_part_id', 'Category.name', 'Category.l_name', 'Category.description'), 'conditions' = array('Category.sp_id = ' .$sp . ' AND Category.sps_part_id = ' . $spPart.' AND Category.parent_id = 0'), 'conditions' = array( 'Category.sp_id' = $sp, 'Category.sps_part_id' = $spPart, 'Category.parent_id' = $parent ) }else { $category = $this-Category-find('threaded', array ( 'conditions' = array('Category.parent_id = ' .$parent) 'conditions' = array('Category.parent_id' = $parent) public function edit ($sp, $spPart, $id) { $category = $this-Category-find('first', array ( 'fields' = array('Category.id, Category.sp_id, Category.sps_part_id, Category.parent_id, Category.name, Category.l_name, Category.description'), 'conditions' = array ( 'Category.sp_id'= $sp, 'Category.sps_part_id' = $spPart, 'Category.id' = $id )) ); $this-set
Auth component deleting Session data for no reason.
Hello, Im using auth component and cofiguring it in my AppController, just cake documentain say. *class AppController extends Controller { public $components = array( 'Session', 'Auth' = array( 'loginRedirect' = array('controller' = 'Sps', 'action' = 'index'), 'logoutRedirect' = array('controller' = 'Users', 'action' = 'index') ) ); public function beforeFilter() {** $this-Auth-allow('login', 'index', 'forgotPassword'); } }* So, when an user join the aplication, they go to Sps/index, with session data, goes to another controller for example, Clients, and still having Session, but when he goes to Category, they lose all the data and i get a white screen with no error and no debug info (trying debug to 2 - 3 and still no info). Im using a hoting, so its hard to access to apache log ... but local debuging it, when i delete the Auth Component from my appController, all works fine. And i dont get White Screen. So basically my problem is that when i go to CategorysController, the user session data is deleted and get a white screen that doesnt spit any info. Pasting my controller: *?php class CategorysController extends AppController { public $helpers = array('Html', 'Form'); public $uses = array ('Category', 'Sp', 'SpsSpsPart', 'SpsPart'); // public $components = array('Session', 'Auth'); public function beforeFilter() { parent::beforeFilter(); $this-layout = 'login'; pr ($this-Session-read('Auth.User')); } public function index () { } public function addCategory ($sp, $spPart, $parent = 0) { if ($this-request-is('post')) { $this-Category-set($this-data); if ($this-Category-validates()) { $category = array ( 'sp_id' = $sp, 'parent_id' = $parent, 'sps_part_id' = $spPart, 'name' = $this-data['Category']['nombre'], 'l_name' = $this-data['Category']['nombrelatin'], 'description' = $this-data['Category']['descripcion'] ); if ($this-Category-save ($category)) { $this-Session-setFlash ('Categoría guardada con éxito.'); $this-redirect(array('controller' = 'Categorys', 'action' = 'showCategory', $sp, $spPart)); } } } } public function showCategory ($sp, $spPart, $parent = null) { if ($parent == null) { $category = $this-Category-find('all', array ( 'fields' = array('Category.id', 'Category.sp_id', 'Category.parent_id', 'Category.sps_part_id', 'Category.name', 'Category.l_name', 'Category.description'), 'conditions' = array('Category.sp_id = ' .$sp . ' AND Category.sps_part_id = ' . $spPart.' AND Category.parent_id = 0'), 'recursive' = 0) ); }else { $category = $this-Category-find('threaded', array ( 'conditions' = array('Category.parent_id = ' .$parent) )); } $this-set('category', $category); } public function edit ($sp, $spPart, $id) { $category = $this-Category-find('first', array ( 'fields' = array('Category.id, Category.sp_id, Category.sps_part_id, Category.parent_id, Category.name, Category.l_name, Category.description'), 'conditions' = array ( 'Category.sp_id'= $sp, 'Category.sps_part_id' = $spPart, 'Category.id' = $id )) ); $this-set('category', $category); if ($this-request-is('post')) { $this-Category-set($this-data); if ($this-Category-validates()) { if ($this-Category-updateAll ( array('name' = '. $this-data['Category']['nombre'] . ', 'l_name' = '. $this-data['Category']['nombrelatin'].', 'description' = '. $this-data['Category']['descripccion'].'), array('Category.id' = $id))) { $this-Session-setFlash ('Se ha editado el nombre con éxito.'); $this-redirect(array('controller' = 'Categorys', 'action' = 'showCategory', $category['Category']['sp_id'], $category['Category']['sps_part_id
Re: Auth component deleting Session data for no reason.
On Thu, Jan 3, 2013 at 6:02 AM, Pedro Fortes Gallego fortesgall...@gmail.com wrote: Hello, Im using auth component and cofiguring it in my AppController, just cake documentain say. class AppController extends Controller { ... public function beforeFilter() { $this-Auth-allow('login', 'index', 'forgotPassword'); This should be in the UsersController, not AppController. And you shouldn't include login in the allow() call. (I know, it's not intuitive.) white screen with no error and no debug info (trying debug to 2 - 3 and still no info). Im using a hoting, so its hard to access to apache log ... A white screen means a fatal PHP error, so Cake doesn't have the chance to log anything. Does your hosting account include an admin panel with access to the server logs? ?php class CategorysController extends AppController { It should be CategoriesController. public $helpers = array('Html', 'Form'); If these two helpers are commonly used you can put this in AppController and leave it out of all of your other controllers. public $uses = array ('Category', 'Sp', 'SpsSpsPart', 'SpsPart'); Are the Sp, SpsSpsPart, and SpsPart models associated with each other? And are any of them associated with Category? If so, you can remove this entire $uses var and chain your model calls like, eg. $this-Category-Sp-SpsPart-doSomething() But it doesn't even look like you're calling methods on those other classes, anyway. // public $components = array('Session', 'Auth'); This is not necessary here because you declared it in AppController, which is the parent of this controller. public function beforeFilter() { parent::beforeFilter(); $this-layout = 'login'; Are you sure you want the login layout for categories? public function addCategory ($sp, $spPart, $parent = 0) { if ($this-request-is('post')) { $this-Category-set($this-data); if ($this-Category-validates()) { $category = array ( 'sp_id' = $sp, 'parent_id' = $parent, 'sps_part_id' = $spPart, 'name' = $this-data['Category']['nombre'], 'l_name' = $this-data['Category']['nombrelatin'], 'description' = $this-data['Category']['descripcion'] ); You've got this a little bit backwards. public function add($sp_id, $sps_part_id, $parent_id = 0) { if ($this-request-is('post')) { $this-data['Category']['sp_id'] = $sp_id; $this-data['Category']['sps_part_id'] = $sps_part_id; $this-data['Category']['parent_id'] = $parent_id; // etc ... $this-Category-set($this-data); if ($this-Category-validates()) { if ($this-Category-save()) { Better: set the sp_id, sps_part_id, and parent_id as view variables and create hidden form fields for them. They'll be in the data array when it is submitted. public function showCategory ($sp, $spPart, $parent = null) { if ($parent == null) { $category = $this-Category-find('all', array ( 'fields' = array('Category.id', 'Category.sp_id', 'Category.parent_id', 'Category.sps_part_id', 'Category.name', 'Category.l_name', 'Category.description'), 'conditions' = array('Category.sp_id = ' .$sp . ' AND Category.sps_part_id = ' . $spPart.' AND Category.parent_id = 0'), 'conditions' = array( 'Category.sp_id' = $sp, 'Category.sps_part_id' = $spPart, 'Category.parent_id' = $parent ) }else { $category = $this-Category-find('threaded', array ( 'conditions' = array('Category.parent_id = ' .$parent) 'conditions' = array('Category.parent_id' = $parent) public function edit ($sp, $spPart, $id) { $category = $this-Category-find('first', array ( 'fields' = array('Category.id, Category.sp_id, Category.sps_part_id, Category.parent_id, Category.name, Category.l_name, Category.description'), 'conditions' = array ( 'Category.sp_id'= $sp, 'Category.sps_part_id' = $spPart, 'Category.id' = $id )) ); $this-set('category', $category); Everything above should come AFTER the if ($this-request-is('post')) block. You don't want to fetch the data if the form has been posted. public function result ($sp, $part, $parent = 0) { $category = $this-Category-find('all', array ( 'fields' = array('Category.id', 'Category.sp_id', 'Category.parent_id', 'Category.sps_part_id', 'Category.name', 'Category.l_name', 'Category.description'), 'conditions' = array('Category.sp_id = ' .$sp . ' AND Category.sps_part_id = ' . $part.' AND Category.parent_id
Re: Auth component doesn't set session variables !
I have the same problem, and change the order of components, but nothing change. if i put $this-Session-read(); , it's work but display a message error for regenerate_id session public function login() { if ($this-request-is('post')) { //$this-Session-read(); if ($this-Auth-login()) { $this-redirect($this-Auth-redirect()); Le jeudi 31 mars 2011 21:11:28 UTC+2, damien durant a écrit : i will try. In fact it's strange. Because i don't touch anything and it works from my home computers. It doesn't from my work, maybe because of proxy setting but it's weird. On Thu, Mar 31, 2011 at 8:42 PM, cricket zijn.d...@gmail.comjavascript: wrote: On Thu, Mar 31, 2011 at 10:43 AM, damien d damien...@gmail.comjavascript: wrote: Hi, I have trouble with the Auth component. I try something really simple : - I create a user db (with name,password field) - I use a appcontroler with this code : var $components = array(Session,Auth); function beforeFilter() { $this-Auth-fields = array('username' = 'name', 'password' = 'password'); $this-Auth-loginAction = array('controller' = 'users', 'action' = 'login'); $this-Auth-loginRedirect = array('controller' = 'discs', 'action' = 'hello'); $this-Auth-logoutRedirect = '/'; $this-Auth-loginError = 'Invalid name / password combination. Please try again'; } - I got a classic login.ctp - and in my discs_controller : function beforeFilter() { $this-Auth-allow(*); parent::beforeFilter(); } The issue is, when i log through the login page, i am correctly redirected, but on the redirect page the Auth variable aren't set. Here is the content of $session-read() on hello.ctp, after login. ($session-read('Auth.User') is empty); Array ( [Config] = Array ( [userAgent] = [time] = 1301618408 [timeout] = 10 ) ) I see there is some trouble with some fix on the net so i : - Configure::write('Session.checkAgent', false); - Configure::write('Security.level', 'low'); in core.php but without any success. Try putting Auth before Session in the $components array. -- 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+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/cake-php -- Damien Durant -- 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.
CakePHP, Opauth and Auth component
Hello there, I have a question regarding Opauth and Cakephp. I am just starting new project and I decided to go with Opauth and few Strategies to develop login system. But, I have a problem, I cannot login user with Auth component from CakePHP. It works nice, I get array of data from social network, but I cannot login user with Auth component. I have tried to debug to see whats happening, but I cannot see the problem. $this-Auth-login() ::: not working $this-Auth-login($this-request-data['User']) :: not working I have tried to manipulate with $this-request-data like this: if ($this-data['auth']['provider'] == 'Google') { //try to find google user $g_id = $this-data['auth']['uid']; $gu = $this-User-find('first', array('conditions' = array('User.g_id' = $g_id), 'recursive' = -1)); if ($gu['User']['g_id']) { $this-request-data['User'] = $gu['User']; $this-request-data['User']['password'] = $gu['User']['g_id']; if ($this-Auth-login($this-request-data['User'])) { $this-Session-setFlash(__('You have successfully logged in.'), 'flash_success'); return $this-redirect('/'); } else { $this-Session-setFlash(__('Something went wrong while login process. Please try again.'), 'auth_error'); return $this-redirect('/'); } } else { //get data for registration } And I just cannot succeed to login user. Also I have added into AppController to beforeFilter: $this-Auth-authenticate = array( AuthComponent::ALL = array('userModel' = 'User'), 'Form', 'Basic' ); So, if you can help me with this, I would be very grateful! P.S. just to mention, Login form through normal post data is working. Greets -- 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: Social Networking Login with Auth Component.
Have a look at Opauth. It's a nice plugin working really well. https://github.com/uzyn/cakephp-opauth -- 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-US.
Re: Social Networking Login with Auth Component.
I think HybridAuth is better in response data provided. Any other suggestion? On Mon, Aug 13, 2012 at 2:21 PM, Braindead markus.he...@gmail.com wrote: Have a look at Opauth. It's a nice plugin working really well. https://github.com/uzyn/cakephp-opauth -- 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-US. -- Warm Regards, Sanjeev http://sanjeevdivekar.wordpress.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 cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: Social Networking Login with Auth Component.
I think HybridAuth is better in response data provided. The only difference I can see is that HybridAuth does automatically login using AuthComponent and Opauth does not. But actually this can be done in a few lines of code. Opauth has the advantage that it is a nice plugin that fits nicely into any Cake app. -- 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-US.
Re: Social Networking Login with Auth Component.
HybridAuth gives more profile data then Opauth. I could't find user's email from demo in Opauth. On Mon, Aug 13, 2012 at 6:00 PM, Braindead markus.he...@gmail.com wrote: I think HybridAuth is better in response data provided. The only difference I can see is that HybridAuth does automatically login using AuthComponent and Opauth does not. But actually this can be done in a few lines of code. Opauth has the advantage that it is a nice plugin that fits nicely into any Cake app. -- 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-US. -- Warm Regards, Sanjeev http://sanjeevdivekar.wordpress.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 cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: Social Networking Login with Auth Component.
Hi Sanjeev, Please have a look on http://umpremium.ektasoftwares.com for authenticating users and other features. On Mon, Aug 13, 2012 at 6:03 PM, Sanjeev Divekar sanjeevdive...@gmail.comwrote: HybridAuth gives more profile data then Opauth. I could't find user's email from demo in Opauth. On Mon, Aug 13, 2012 at 6:00 PM, Braindead markus.he...@gmail.com wrote: I think HybridAuth is better in response data provided. The only difference I can see is that HybridAuth does automatically login using AuthComponent and Opauth does not. But actually this can be done in a few lines of code. Opauth has the advantage that it is a nice plugin that fits nicely into any Cake app. -- 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-US. -- Warm Regards, Sanjeev http://sanjeevdivekar.wordpress.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 cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US. -- Thanks Regards Chetan Varshney Director of Ekta Softwares Noida India Website- EktaSoftwares.Com http://www.ektasoftwares.com Email- chetanvarsh...@gmail.com Skype- chetan-varshney Mob no- +919891538749 -- 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-US.
Re: Social Networking Login with Auth Component.
I will stick to CakePHP's basic Auth component. On Mon, Aug 13, 2012 at 6:05 PM, Chetan Varshney chetanvarsh...@gmail.comwrote: Hi Sanjeev, Please have a look on http://umpremium.ektasoftwares.com for authenticating users and other features. On Mon, Aug 13, 2012 at 6:03 PM, Sanjeev Divekar sanjeevdive...@gmail.com wrote: HybridAuth gives more profile data then Opauth. I could't find user's email from demo in Opauth. On Mon, Aug 13, 2012 at 6:00 PM, Braindead markus.he...@gmail.comwrote: I think HybridAuth is better in response data provided. The only difference I can see is that HybridAuth does automatically login using AuthComponent and Opauth does not. But actually this can be done in a few lines of code. Opauth has the advantage that it is a nice plugin that fits nicely into any Cake app. -- 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-US. -- Warm Regards, Sanjeev http://sanjeevdivekar.wordpress.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 cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US. -- Thanks Regards Chetan Varshney Director of Ekta Softwares Noida India Website- EktaSoftwares.Com http://www.ektasoftwares.com Email- chetanvarsh...@gmail.com Skype- chetan-varshney Mob no- +919891538749 -- 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-US. -- Warm Regards, Sanjeev http://sanjeevdivekar.wordpress.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 cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Social Networking Login with Auth Component.
Hello, While googling I found hybridauth as social networking login library. Any better or similar suggestion? Regards, -- 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-US.
Problem with multiple testAction calls with mocked Auth component - 2.2.1
After upgrading to 2.2.1 from 2.0.x some of my controller tests are failing. It seems as if a mocked Auth component does not survive multiple testAction calls. Am I doing something wrong here or is this expected? CandidatesControllerTest.php public function testExportAdmin() { $Candidates = $this-generate('Candidates', array( 'components' = array('Auth' = array('user')) )); $Candidates-Auth -staticExpects($this-any()) -method('user') -with($this-equalTo('type')) -will($this-returnValue('admin')); $this-testAction('/candidates/export/active.csv'); $this-assertEquals(2, count($this-vars['data'])); $this-testAction('/candidates/export/historical.csv'); $this-assertEquals(3, count($this-vars['data'])); } Throwing a debug call in my CandidatesController.php for $this-Auth-user('type') returns 'admin' on the first testAction, but null on the second. Any ideas? -- 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: Problem with multiple testAction calls with mocked Auth component - 2.2.1
I've discovered this doesn't happen when i am logged in to the app itself. I am quite confused. On Monday, July 23, 2012 10:58:34 AM UTC-4, Dave M. wrote: After upgrading to 2.2.1 from 2.0.x some of my controller tests are failing. It seems as if a mocked Auth component does not survive multiple testAction calls. Am I doing something wrong here or is this expected? CandidatesControllerTest.php public function testExportAdmin() { $Candidates = $this-generate('Candidates', array( 'components' = array('Auth' = array('user')) )); $Candidates-Auth -staticExpects($this-any()) -method('user') -with($this-equalTo('type')) -will($this-returnValue('admin')); $this-testAction('/candidates/export/active.csv'); $this-assertEquals(2, count($this-vars['data'])); $this-testAction('/candidates/export/historical.csv'); $this-assertEquals(3, count($this-vars['data'])); } Throwing a debug call in my CandidatesController.php for $this-Auth-user('type') returns 'admin' on the first testAction, but null on the second. Any ideas? -- 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: Problem with multiple testAction calls with mocked Auth component - 2.2.1
Thumbrule - one testAction per test HTH Tarique On Tue, Jul 24, 2012 at 6:14 AM, Dave M. mil...@gmail.com wrote: I've discovered this doesn't happen when i am logged in to the app itself. I am quite confused. On Monday, July 23, 2012 10:58:34 AM UTC-4, Dave M. wrote: After upgrading to 2.2.1 from 2.0.x some of my controller tests are failing. It seems as if a mocked Auth component does not survive multiple testAction calls. Am I doing something wrong here or is this expected? CandidatesControllerTest.php public function testExportAdmin() { $Candidates = $this-generate('Candidates', array( 'components' = array('Auth' = array('user')) )); $Candidates-Auth -staticExpects($this-any()) -method('user') -with($this-equalTo('type')) -will($this-returnValue('admin')); $this-testAction('/candidates/export/active.csv'); $this-assertEquals(2, count($this-vars['data'])); $this-testAction('/candidates/export/historical.csv'); $this-assertEquals(3, count($this-vars['data'])); } Throwing a debug call in my CandidatesController.php for $this-Auth-user('type') returns 'admin' on the first testAction, but null on the second. Any ideas? -- 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 -- = PHP for E-Biz: http://sanisoft.com = -- 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
Bad Redirect with auth component.
Hi Folks, Please help I have this code in my AppController public $components = array('Session','Auth'= array( //Error to display when user attempts to access an object or action to which they do not have access. 'authError' = 'You need to login to access the page', 'authorize' = array('controller'), 'loginRedirect'= array('controller'='users','controller'='edit' ), 'logoutRedirect'= array('controller'='users','controller'='logout' ) ) ); Here are the corresponding functions for login and log out public function login() { if ($this-request-is('post')){ if ($this-Auth-login()) { $this-redirect($this-Auth-redirect()); } else { $this-Session-setFlash(__('Invalid username or password, try again')); } } } public function logout() { $this-Session-setFlash('Good-Bye'); $this-redirect($this-Auth-logout()); } As per my assumption i should be redirected url/users/edit after login and url/users/index after logout, but instead i am redirecting to url/edit and url/index respectively.* What seems to be the error? *Thanks for your help in advance -- Best Regards, Mohit Kumar -- 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: Bad Redirect with auth component.
'action' = 'edit' 'action' = 'index' ;-p On Wed, Jul 11, 2012 at 3:02 PM, mohit kumar mohitk...@gmail.com wrote: Hi Folks, Please help I have this code in my AppController public $components = array('Session','Auth'= array( //Error to display when user attempts to access an object or action to which they do not have access. 'authError' = 'You need to login to access the page', 'authorize' = array('controller'), 'loginRedirect'= array('controller'='users','controller'='edit' ), 'logoutRedirect'= array('controller'='users','controller'='logout' ) ) ); Here are the corresponding functions for login and log out public function login() { if ($this-request-is('post')){ if ($this-Auth-login()) { $this-redirect($this-Auth-redirect()); } else { $this-Session-setFlash(__('Invalid username or password, try again')); } } } public function logout() { $this-Session-setFlash('Good-Bye'); $this-redirect($this-Auth-logout()); } As per my assumption i should be redirected url/users/edit after login and url/users/index after logout, but instead i am redirecting to url/edit and url/index respectively. What seems to be the error? Thanks for your help in advance -- Best Regards, Mohit Kumar -- 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 -- 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: Bad Redirect with auth component.
'loginRedirect'= array('controller'='users','controller'='edit' ), 'logoutRedirect'= array('controller'='users','controller'='logout' ) you have twice 'controller' listen what lowpass said :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/7/11 lowpass zijn.digi...@gmail.com 'action' = 'edit' 'action' = 'index' ;-p On Wed, Jul 11, 2012 at 3:02 PM, mohit kumar mohitk...@gmail.com wrote: Hi Folks, Please help I have this code in my AppController public $components = array('Session','Auth'= array( //Error to display when user attempts to access an object or action to which they do not have access. 'authError' = 'You need to login to access the page', 'authorize' = array('controller'), 'loginRedirect'= array('controller'='users','controller'='edit' ), 'logoutRedirect'= array('controller'='users','controller'='logout' ) ) ); Here are the corresponding functions for login and log out public function login() { if ($this-request-is('post')){ if ($this-Auth-login()) { $this-redirect($this-Auth-redirect()); } else { $this-Session-setFlash(__('Invalid username or password, try again')); } } } public function logout() { $this-Session-setFlash('Good-Bye'); $this-redirect($this-Auth-logout()); } As per my assumption i should be redirected url/users/edit after login and url/users/index after logout, but instead i am redirecting to url/edit and url/index respectively. What seems to be the error? Thanks for your help in advance -- Best Regards, Mohit Kumar -- 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 -- 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 -- 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: Bad Redirect with auth component.
thats silly of me :( On Thu, Jul 12, 2012 at 2:01 AM, Tilen Majerle tilen.maje...@gmail.comwrote: 'loginRedirect'= array('controller'='users','controller'='edit' ), 'logoutRedirect'= array('controller'='users','controller'='logout' ) you have twice 'controller' listen what lowpass said :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/7/11 lowpass zijn.digi...@gmail.com 'action' = 'edit' 'action' = 'index' ;-p On Wed, Jul 11, 2012 at 3:02 PM, mohit kumar mohitk...@gmail.com wrote: Hi Folks, Please help I have this code in my AppController public $components = array('Session','Auth'= array( //Error to display when user attempts to access an object or action to which they do not have access. 'authError' = 'You need to login to access the page', 'authorize' = array('controller'), 'loginRedirect'= array('controller'='users','controller'='edit' ), 'logoutRedirect'= array('controller'='users','controller'='logout' ) ) ); Here are the corresponding functions for login and log out public function login() { if ($this-request-is('post')){ if ($this-Auth-login()) { $this-redirect($this-Auth-redirect()); } else { $this-Session-setFlash(__('Invalid username or password, try again')); } } } public function logout() { $this-Session-setFlash('Good-Bye'); $this-redirect($this-Auth-logout()); } As per my assumption i should be redirected url/users/edit after login and url/users/index after logout, but instead i am redirecting to url/edit and url/index respectively. What seems to be the error? Thanks for your help in advance -- Best Regards, Mohit Kumar -- 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 -- 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 -- 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 -- Best Regards, Mohit Kumar -- 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: User Info from Auth Component
This could be the case - a wrongly implemented Authentication system. @Joey Hauschildt $this-Auth-user() and the Auth.User Session key should both return/contain the full user information - i.e. all fields from the users DB table. This behaviour is strange. Can you provide more info on your exact implementation. Cheers, Borislav. On Wednesday, 20 June 2012 00:36:24 UTC+3, Max Dörfler wrote: http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in In 2.0 $this-Auth-login($this-request-data) will log the user in with whatever data is posted, whereas in 1.3 $this-Auth-login($this-data) would try to identify the user first and only log in when successful. I assume you are yousing 2.x. I guess this is what you are looking for. Call login() without params. On 06/19/2012 11:18 PM, Joey Hauschildt wrote: I am. All passwords in the db are hashed. The problem seems to be that instead of getting info from the users table, it is only filling debug($this-Session-read('Auth.User')); and debug($this-Auth-User()) with data from the form. Otherwise the password would be hashed. It has nowhere else to get an unhashed password from. This seems like a pretty poor choice for default behavior. I would prefer that my app didn't store passwords from the form anywhere. On Tuesday, June 19, 2012 2:50:45 PM UTC-6, Jeremy Burns wrote: You should be hashing the password before saving it. Jeremy Burns Class Outfit http://www.classoutfit.com On 19 Jun 2012, at 19:41:30, Joey Hauschildt wrote: debug($this-Session-read('Auth.User')); and debug($this-Auth-User()); both return: array( 'User' = array( 'password' = '*', 'email' = 't...@example.com' ) ) These are the fields that the user uses to log in. The password isn't even hashed. When I print_r, it displays the actual password. I would like to have access to other user info like an ID or role. Do I need to use my own query to get this info or should the Auth Component be grabbing that stuff for me?. -- 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 -- 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 -- 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: User Info from Auth Component
I just followed the tutorial in the book. The only custimization I made was was using the email field instead of the username field. Here is my AppController: class AppController extends Controller { public $uses = array('User'); public $components = array( 'Session', 'Auth' = array( 'loginRedirect' = array('controller' = 'posts', 'action' = 'index'), 'logoutRedirect' = array('controller' = 'pages', 'action' = 'display', 'home') ) ); public function beforeFilter() { $this-Auth-allow('index', 'view'); $this-set('logged_in', $this-Auth-LoggedIn()); $this-set('current_user', $this-Auth-user()); //debug($this-Session-read('Auth.User')); } public function isAuthorized($user) { return TRUE; } } And here is my Users/login action: public function login() { if ($this-request-is('post')) { if ($this-Auth-login($this-request-data)) { return $this-redirect($this-Auth-redirect()); } else { $this-Session-setFlash(__('Username or password is incorrect'), 'default', array(), 'auth'); } } } The beforeFilter in my Users controller: public function beforeFilter() { parent::beforeFilter(); $this-Auth-fields = array('username' = 'email', 'password' = 'password'); $this-Auth-allow('add', 'logout'); } On Wednesday, June 20, 2012 12:31:35 AM UTC-6, Борислав Събев wrote: This could be the case - a wrongly implemented Authentication system. @Joey Hauschildt $this-Auth-user() and the Auth.User Session key should both return/contain the full user information - i.e. all fields from the users DB table. This behaviour is strange. Can you provide more info on your exact implementation. Cheers, Borislav. On Wednesday, 20 June 2012 00:36:24 UTC+3, Max Dörfler wrote: http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in In 2.0 $this-Auth-login($this-request-data) will log the user in with whatever data is posted, whereas in 1.3 $this-Auth-login($this-data) would try to identify the user first and only log in when successful. I assume you are yousing 2.x. I guess this is what you are looking for. Call login() without params. On 06/19/2012 11:18 PM, Joey Hauschildt wrote: I am. All passwords in the db are hashed. The problem seems to be that instead of getting info from the users table, it is only filling debug($this-Session-read('Auth.User')); and debug($this-Auth-User()) with data from the form. Otherwise the password would be hashed. It has nowhere else to get an unhashed password from. This seems like a pretty poor choice for default behavior. I would prefer that my app didn't store passwords from the form anywhere. On Tuesday, June 19, 2012 2:50:45 PM UTC-6, Jeremy Burns wrote: You should be hashing the password before saving it. Jeremy Burns Class Outfit http://www.classoutfit.com On 19 Jun 2012, at 19:41:30, Joey Hauschildt wrote: debug($this-Session-read('Auth.User')); and debug($this-Auth-User()); both return: array( 'User' = array( 'password' = '*', 'email' = 't...@example.com' ) ) These are the fields that the user uses to log in. The password isn't even hashed. When I print_r, it displays the actual password. I would like to have access to other user info like an ID or role. Do I need to use my own query to get this info or should the Auth Component be grabbing that stuff for me?. -- 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 -- 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 -- 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: User Info from Auth Component
Like I said: You are passing data into the login function. In 2.0 this will log the user in with whatever data is posted. Thats why only the two fields posted are displayed and the PW isn't hashed. Since you haven't specified what version of cake you are using, I still assume this is the reason. If you say you don't use cake 2.x I'll stop bothering you. ;) On 06/20/2012 09:27 PM, Joey Hauschildt wrote: I just followed the tutorial in the book. The only custimization I made was was using the email field instead of the username field. Here is my AppController: class AppController extends Controller { public $uses = array('User'); public $components = array( 'Session', 'Auth' = array( 'loginRedirect' = array('controller' = 'posts', 'action' = 'index'), 'logoutRedirect' = array('controller' = 'pages', 'action' = 'display', 'home') ) ); public function beforeFilter() { $this-Auth-allow('index', 'view'); $this-set('logged_in', $this-Auth-LoggedIn()); $this-set('current_user', $this-Auth-user()); //debug($this-Session-read('Auth.User')); } public function isAuthorized($user) { return TRUE; } } And here is my Users/login action: public function login() { if ($this-request-is('post')) { if ($this-Auth-login($this-request-data)) { return $this-redirect($this-Auth-redirect()); } else { $this-Session-setFlash(__('Username or password is incorrect'), 'default', array(), 'auth'); } } } The beforeFilter in my Users controller: public function beforeFilter() { parent::beforeFilter(); $this-Auth-fields = array('username' = 'email', 'password' = 'password'); $this-Auth-allow('add', 'logout'); } On Wednesday, June 20, 2012 12:31:35 AM UTC-6, Борислав Събев wrote: This could be the case - a wrongly implemented Authentication system. @Joey Hauschildt $this-Auth-user() and the Auth.User Session key should both return/contain the full user information - i.e. all fields from the users DB table. This behaviour is strange. Can you provide more info on your exact implementation. Cheers, Borislav. On Wednesday, 20 June 2012 00:36:24 UTC+3, Max Dörfler wrote: http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in In 2.0 $this-Auth-login($this-request-data) will log the user in with whatever data is posted, whereas in 1.3 $this-Auth-login($this-data) would try to identify the user first and only log in when successful. I assume you are yousing 2.x. I guess this is what you are looking for. Call login() without params. On 06/19/2012 11:18 PM, Joey Hauschildt wrote: I am. All passwords in the db are hashed. The problem seems to be that instead of getting info from the users table, it is only filling debug($this-Session-read('Auth.User')); and debug($this-Auth-User()) with data from the form. Otherwise the password would be hashed. It has nowhere else to get an unhashed password from. This seems like a pretty poor choice for default behavior. I would prefer that my app didn't store passwords from the form anywhere. On Tuesday, June 19, 2012 2:50:45 PM UTC-6, Jeremy Burns wrote: You should be hashing the password before saving it. Jeremy Burns Class Outfit http://www.classoutfit.com On 19 Jun 2012, at 19:41:30, Joey Hauschildt wrote: debug($this-Session-read('Auth.User')); and debug($this-Auth-User()); both return: array( 'User' = array( 'password' = '*', 'email' = 't...@example.com mailto:t...@example.com' ) ) These are the fields that the user uses to log in. The password isn't even hashed. When I print_r, it displays the actual password. I would like to have access to other user info like an ID or role. Do I need to use my own query to get this info or should the Auth Component be grabbing that stuff for me?. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org http://tv.cakephp.org/ Check out the new CakePHP Questions site http://ask.cakephp.org 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 mailto:cake-php+unsubscr
Re: User Info from Auth Component
Yup, let me clarify a bit more, you're passing $this-reuqest-data into $this-Auth-login(): $this-Auth-login($this-request-data) This will always log the user in no matter what is posted! On Thursday, 21 June 2012 00:37:07 UTC+3, Max Dörfler wrote: Like I said: You are passing data into the login function. In 2.0 this will log the user in with whatever data is posted. Thats why only the two fields posted are displayed and the PW isn't hashed. Since you haven't specified what version of cake you are using, I still assume this is the reason. If you say you don't use cake 2.x I'll stop bothering you. ;) On 06/20/2012 09:27 PM, Joey Hauschildt wrote: I just followed the tutorial in the book. The only custimization I made was was using the email field instead of the username field. Here is my AppController: class AppController extends Controller { public $uses = array('User'); public $components = array( 'Session', 'Auth' = array( 'loginRedirect' = array('controller' = 'posts', 'action' = 'index'), 'logoutRedirect' = array('controller' = 'pages', 'action' = 'display', 'home') ) ); public function beforeFilter() { $this-Auth-allow('index', 'view'); $this-set('logged_in', $this-Auth-LoggedIn()); $this-set('current_user', $this-Auth-user()); //debug($this-Session-read('Auth.User')); } public function isAuthorized($user) { return TRUE; } } And here is my Users/login action: public function login() { if ($this-request-is('post')) { if ($this-Auth-login($this-request-data)) { return $this-redirect($this-Auth-redirect()); } else { $this-Session-setFlash(__('Username or password is incorrect'), 'default', array(), 'auth'); } } } The beforeFilter in my Users controller: public function beforeFilter() { parent::beforeFilter(); $this-Auth-fields = array('username' = 'email', 'password' = 'password'); $this-Auth-allow('add', 'logout'); } On Wednesday, June 20, 2012 12:31:35 AM UTC-6, Борислав Събев wrote: This could be the case - a wrongly implemented Authentication system. @Joey Hauschildt $this-Auth-user() and the Auth.User Session key should both return/contain the full user information - i.e. all fields from the users DB table. This behaviour is strange. Can you provide more info on your exact implementation. Cheers, Borislav. On Wednesday, 20 June 2012 00:36:24 UTC+3, Max Dörfler wrote: http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in In 2.0 $this-Auth-login($this-request-data) will log the user in with whatever data is posted, whereas in 1.3 $this-Auth-login($this-data) would try to identify the user first and only log in when successful. I assume you are yousing 2.x. I guess this is what you are looking for. Call login() without params. On 06/19/2012 11:18 PM, Joey Hauschildt wrote: I am. All passwords in the db are hashed. The problem seems to be that instead of getting info from the users table, it is only filling debug($this-Session-read('Auth.User')); and debug($this-Auth-User()) with data from the form. Otherwise the password would be hashed. It has nowhere else to get an unhashed password from. This seems like a pretty poor choice for default behavior. I would prefer that my app didn't store passwords from the form anywhere. On Tuesday, June 19, 2012 2:50:45 PM UTC-6, Jeremy Burns wrote: You should be hashing the password before saving it. Jeremy Burns Class Outfit http://www.classoutfit.com On 19 Jun 2012, at 19:41:30, Joey Hauschildt wrote: debug($this-Session-read('Auth.User')); and debug($this-Auth-User()); both return: array( 'User' = array( 'password' = '*', 'email' = 't...@example.com' ) ) These are the fields that the user uses to log in. The password isn't even hashed. When I print_r, it displays the actual password. I would like to have access to other user info like an ID or role. Do I need to use my own query to get this info or should the Auth Component be grabbing that stuff for me?. -- 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 -- 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
User Info from Auth Component
debug($this-Session-read('Auth.User')); and debug($this-Auth-User()); both return: array( 'User' = array( 'password' = '*', 'email' = 't...@example.com' ) ) These are the fields that the user uses to log in. The password isn't even hashed. When I print_r, it displays the actual password. I would like to have access to other user info like an ID or role. Do I need to use my own query to get this info or should the Auth Component be grabbing that stuff for me?. -- 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: User Info from Auth Component
You should be hashing the password before saving it. Jeremy Burns Class Outfit http://www.classoutfit.com On 19 Jun 2012, at 19:41:30, Joey Hauschildt wrote: debug($this-Session-read('Auth.User')); and debug($this-Auth-User()); both return: array( 'User' = array( 'password' = '*', 'email' = 't...@example.com' ) ) These are the fields that the user uses to log in. The password isn't even hashed. When I print_r, it displays the actual password. I would like to have access to other user info like an ID or role. Do I need to use my own query to get this info or should the Auth Component be grabbing that stuff for me?. -- 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 -- 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: User Info from Auth Component
I am. All passwords in the db are hashed. The problem seems to be that instead of getting info from the users table, it is only filling debug($this-Session-read('Auth.User')); and debug($this-Auth-User()) with data from the form. Otherwise the password would be hashed. It has nowhere else to get an unhashed password from. This seems like a pretty poor choice for default behavior. I would prefer that my app didn't store passwords from the form anywhere. On Tuesday, June 19, 2012 2:50:45 PM UTC-6, Jeremy Burns wrote: You should be hashing the password before saving it. Jeremy Burns Class Outfit http://www.classoutfit.com On 19 Jun 2012, at 19:41:30, Joey Hauschildt wrote: debug($this-Session-read('Auth.User')); and debug($this-Auth-User()); both return: array( 'User' = array( 'password' = '*', 'email' = 't...@example.com' ) ) These are the fields that the user uses to log in. The password isn't even hashed. When I print_r, it displays the actual password. I would like to have access to other user info like an ID or role. Do I need to use my own query to get this info or should the Auth Component be grabbing that stuff for me?. -- 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 -- 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: User Info from Auth Component
http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in In 2.0 $this-Auth-login($this-request-data) will log the user in with whatever data is posted, whereas in 1.3 $this-Auth-login($this-data) would try to identify the user first and only log in when successful. I assume you are yousing 2.x. I guess this is what you are looking for. Call login() without params. On 06/19/2012 11:18 PM, Joey Hauschildt wrote: I am. All passwords in the db are hashed. The problem seems to be that instead of getting info from the users table, it is only filling debug($this-Session-read('Auth.User')); and debug($this-Auth-User()) with data from the form. Otherwise the password would be hashed. It has nowhere else to get an unhashed password from. This seems like a pretty poor choice for default behavior. I would prefer that my app didn't store passwords from the form anywhere. On Tuesday, June 19, 2012 2:50:45 PM UTC-6, Jeremy Burns wrote: You should be hashing the password before saving it. Jeremy Burns Class Outfit http://www.classoutfit.com On 19 Jun 2012, at 19:41:30, Joey Hauschildt wrote: debug($this-Session-read('Auth.User')); and debug($this-Auth-User()); both return: array( 'User' = array( 'password' = '*', 'email' = 't...@example.com mailto:t...@example.com' ) ) These are the fields that the user uses to log in. The password isn't even hashed. When I print_r, it displays the actual password. I would like to have access to other user info like an ID or role. Do I need to use my own query to get this info or should the Auth Component be grabbing that stuff for me?. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org http://tv.cakephp.org/ Check out the new CakePHP Questions site http://ask.cakephp.org 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 mailto:cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php http://groups.google.com/group/cake-php -- 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 -- 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: cake 2.x auth component bugs with pages controller after changing htaccess files
Hello All, how to delete Multiple tables fields values in cakephp 2.0 -- 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: cake 2.x auth component bugs with pages controller after changing htaccess files
You can make a sql qury which will delete all from given range.. I think it would be best for performances as well On May 19, 4:55 am, Jimit Kapadya ji...@entourage.in wrote: Hello All, how to delete Multiple tables fields values in cakephp 2.0 -- 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
cake 2.x auth component bugs with pages controller after changing htaccess files
Hi, this is really strange question. I made a simple web presentation (so far I have used cake 1.3 this is my first 2.x project), and added AUTH component looking at the tutorial from this link : http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.html Ok so here is my problem. I have overridden pages controller and made 4 more. They all run perfectly in local host, however , only pages controller bugs on the server. In order to upload code and make it work I had to change my 3 htaccess files , because sever was giving me internal sever error without base variable. Now here is the funny part. The pages controller shows blank page with no errors, even in debug mode 2, whenever I try to access any of the functions for which you have to be logged in to use. Only pages controller, which doesn't use anything unusual, or unstandard. Just a plain blank page and only on that server. In local host it runs normaly. So I did the following : 1) I checked if there is any blank space left - no 2) I checked if allowed functions work - they do 3) When I put smth in before filter and do var_dump it prints it. 4) I tried to print user from session of from auth component , I get null - although in other controllers it works ok 5) This all happens regardless if I am loged in or out 6) I do not get redirected when the function is allowed for normal users, I only get the blank page , i checked to surce of the page, nothing, just html and body tags empty again 7) when i make auth-allow('*') everything runs ok. So only the functions which are not allowed. Since I wasted a whole day on this, I am going to rename the controller and try again because all others are working fine, and in local host even pages work fine. I suppose that since I had to change htaccess files, auth component bugs, but I cant guess what. I will post update about this, however if someone had a similar situation and solved it please help. I guess somehow I got different sessions for these controllers but I have no idea how or why... 0.O ty in advance -- 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: cake 2.x auth component bugs with pages controller after changing htaccess files
I figured id out.. So I did have a char in the end of my while it is because I maade my controller UTF 8 beacuse of some warnings that I needed to make in serbian. However, I didn't make it utf 8 without BOM (notepad ++ has that option), lousy missclick Strange things are the following : in local host , it worked 0.O second thing is, ACL-Allow worked when you make all allowed but doesn't when you need to check if someone is logged in. This behaviour is super strange, because only AUTH component had the problem with my controller. If it was allowed it worked .. Anywyas LOZ .. I just wasted a day on that .. But at least its over .. On 18 мај, 23:35, Miloš Vučinić milosvuci...@gmail.com wrote: Hi, this is really strange question. I made a simple web presentation (so far I have used cake 1.3 this is my first 2.x project), and added AUTH component looking at the tutorial from this link :http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-cont... Ok so here is my problem. I have overridden pages controller and made 4 more. They all run perfectly in local host, however , only pages controller bugs on the server. In order to upload code and make it work I had to change my 3 htaccess files , because sever was giving me internal sever error without base variable. Now here is the funny part. The pages controller shows blank page with no errors, even in debug mode 2, whenever I try to access any of the functions for which you have to be logged in to use. Only pages controller, which doesn't use anything unusual, or unstandard. Just a plain blank page and only on that server. In local host it runs normaly. So I did the following : 1) I checked if there is any blank space left - no 2) I checked if allowed functions work - they do 3) When I put smth in before filter and do var_dump it prints it. 4) I tried to print user from session of from auth component , I get null - although in other controllers it works ok 5) This all happens regardless if I am loged in or out 6) I do not get redirected when the function is allowed for normal users, I only get the blank page , i checked to surce of the page, nothing, just html and body tags empty again 7) when i make auth-allow('*') everything runs ok. So only the functions which are not allowed. Since I wasted a whole day on this, I am going to rename the controller and try again because all others are working fine, and in local host even pages work fine. I suppose that since I had to change htaccess files, auth component bugs, but I cant guess what. I will post update about this, however if someone had a similar situation and solved it please help. I guess somehow I got different sessions for these controllers but I have no idea how or why... 0.O ty in advance -- 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: Can't call Auth component from controller
You're loading Cake's Auth in the $components array. If you're extending that component you need to load 'OrgAuthorize'. On Sun, May 13, 2012 at 5:51 PM, bs28723 bill.sto...@boosterwebsolutions.com wrote: I wrote an Auth Component. It gets a bunch of permission information about the current user. How can I pass this information back to the controller? In AppContoller.php public $components = array( 'Auth' = array( 'loginRedirect' = array('controller' = 'users', 'action' = 'index'), 'logoutRedirect' = array('controller' = 'users', 'action' = 'index'), 'authError' = You can't access that page, 'authorize' = array('Org','Controller') ), 'Session' ); Everything is working, but I can't call any functions in my Controller/Component/Auth/OrgAuthorize.php like... $this-Auth-Org-check(); I get Fatal error: Call to a member function getPerms() on a non-object How can I get this to work? I don't want to replace the current Auth Component with myAuth. Thanks, bill View this message in context: Can't call Auth component from controller Sent from the CakePHP mailing list archive at Nabble.com. -- 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 -- 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: Can't call Auth component from controller
Thanks for the reply. Maybe I am doing something wrong, but I think what I setup was a Custom Authorize Object? http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html So, maybe I did not ask the question right If I create a Authorized Object Class called OrgAuthorize.php in app/Controller/Components/Auth/ Is there a way to call other methods of this class in a Controller? Thanks, Bill On 5/16/2012 8:22 PM, lowpass [via CakePHP] wrote: You're loading Cake's Auth in the $components array. If you're extending that component you need to load 'OrgAuthorize'. On Sun, May 13, 2012 at 5:51 PM, bs28723 lt; [hidden email] gt; wrote: gt; I wrote an Auth Component. It gets a bunch of permission information about gt; the current user. gt; How can I pass this information back to the controller? gt; gt; In AppContoller.php gt; public $components = array( gt; 'Auth' =gt; array( gt; 'loginRedirect' =gt; array('controller' =gt; 'users', 'action' =gt; gt; 'index'), gt; 'logoutRedirect' =gt; array('controller' =gt; 'users', 'action' =gt; gt; 'index'), gt; 'authError' =gt; You can't access that page, gt; 'authorize' =gt; array('Org','Controller') gt; ), gt; 'Session' gt; ); gt; gt; Everything is working, but I can't call any functions in my gt; Controller/Component/Auth/OrgAuthorize.php gt; gt; like... gt; gt; $this-gt;Auth-gt;Org-gt;check(); gt; gt; I get gt; Fatal error: Call to a member function getPerms() on a non-object gt; gt; How can I get this to work? I don't want to replace the current Auth gt; Component with myAuth. gt; gt; Thanks, gt; bill gt; gt; gt; gt; View this message in context: Can't call Auth component from controller gt; Sent from the CakePHP mailing list archive at Nabble.com. gt; gt; -- gt; Our newest site for the community: CakePHP Video Tutorials gt; http://tv.cakephp.org gt; Check out the new CakePHP Questions site http://ask.cakephp.org and help gt; others with their CakePHP related questions. gt; gt; gt; To unsubscribe from this group, send email to gt; [hidden email] For more options, visit this group at gt; http://groups.google.com/group/cake-php -- 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 [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php If you reply to this email, your message will be added to the discussion below: http://cakephp.1045679.n5.nabble.com/Can-t-call-Auth-component-from-controller-tp5707908p5708020.html To start a new topic under CakePHP, email ml-node+s1045679n125572...@n5.nabble.com To unsubscribe from CakePHP, click here . NAML -- View this message in context: http://cakephp.1045679.n5.nabble.com/Can-t-call-Auth-component-from-controller-tp5707908p5708026.html Sent from the CakePHP mailing list archive at Nabble.com. -- 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
Can't call Auth component from controller
I wrote an Auth Component. It gets a bunch of permission information about the current user. How can I pass this information back to the controller? In AppContoller.php nbsp;nbsp;nbsp; public $components = array( nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 'Auth' =gt; array( nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 'loginRedirect' =gt; array('controller' =gt; 'users', 'action' =gt; 'index'), nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 'logoutRedirect' =gt; array('controller' =gt; 'users', 'action' =gt; 'index'), nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 'authError' =gt; You can't access that page, nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 'authorize' =gt; array('Org','Controller')nbsp; nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; ), nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 'Session' nbsp;nbsp;nbsp; );nbsp;nbsp;nbsp; Everything is working, but I can't call any functions in my nbsp;nbsp; Controller/Component/Auth/OrgAuthorize.php like... nbsp; nbsp;nbsp; $this-gt;Auth-gt;Org-gt;check(); I get Fatal error: Call to a member function getPerms() on a non-object How can I get this to work?nbsp; I don't want to replace the current Auth Component with myAuth. Thanks, bill -- View this message in context: http://cakephp.1045679.n5.nabble.com/Can-t-call-Auth-component-from-controller-tp5707908.html Sent from the CakePHP mailing list archive at Nabble.com. -- 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
Auth component in requestAction
I have one element in a view using requestAction. This view is permitted in Auth, but is blocked because it is call requestAction can not afford it. Does anyone know how to reach her at Auth. EX: $ this- Auth- allow ('element / bláblábláblá') thank you Translated by Google (en | en) -- Jackson Bicalho jacksonbica...@gmail.com jacksonbicalho.com.br .. Luango - Sistemas e serviços para Internet www.luango.com.br Precisando de ajuda? Acesse: suporte.luango.com.br Acompanhe nosso Blog: blog.luango.com.br .. cont...@luango.com.br Horário de atendimento: - De segunda a sexta: - - das 8:00 as 12:00 - - das 13:30 as 18:00 -- 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 component WITHOUT ACL blocks every controller action
I would not recommend this for a couple of reasons: 1. isAuthorized expects a boolean back, $this-Auth-user() returns null (falsey) or an array (truthy). This could break in the future. 2. It allows everyone in everywhere if they are just logged in (I guess that's okay if that's the intended functionality). On Tuesday, April 17, 2012 11:13:53 PM UTC-7, muka wrote: Probably a more correct way could be function isAuthorized(){ return $this-Auth-user(); } Il 18/04/2012 00:24, jeremyharris ha scritto: Setting $this-Auth-authorize = array('Controller'); tells the AuthComponent where to run the `isAuthorized()` method, in this case, the Controller. You can find more info here: http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#using-controllerauthorize On Tuesday, April 17, 2012 2:45:56 PM UTC-7, DigitalDude wrote: Hey, h as I changed the code to the snippet of stork, it gave me a ... function isAuthorized() on a non-object (auth-component line 52). When I added the code of luca capra, everything is working as expected. All actions that are not allowed by $this-Auth-allow() within beforeFilter-functions of my controllers are blocked when not logged in. When logged in, I can use those actions. Thank you very much, both of you. It's still weird about the error with the auth-component and the isAuthorized() function, but as it now works I will go deeper into the code of the Auth component later. If anyone has an explanation for this, it would be great to discuss it! Again, thank you very much, that saved me a lot of time! Regards, DD On 17 Apr., 16:03, stork lubomir.st...@gmail.com wrote: $this-Auth-authorize = 'controllers'; $this-Auth-authorize = array('Controller'); -- 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 -- 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 component in requestAction
You allow actions in the controller, not views or elements. On Thu, Apr 19, 2012 at 8:32 AM, Jackson Bicalho jacksonbica...@gmail.com wrote: I have one element in a view using requestAction. This view is permitted in Auth, but is blocked because it is call requestAction can not afford it. Does anyone know how to reach her at Auth. EX: $ this- Auth- allow ('element / bláblábláblá') thank you Translated by Google (en | en) -- Jackson Bicalho jacksonbica...@gmail.com jacksonbicalho.com.br .. Luango - Sistemas e serviços para Internet www.luango.com.br Precisando de ajuda? Acesse: suporte.luango.com.br Acompanhe nosso Blog: blog.luango.com.br .. cont...@luango.com.br Horário de atendimento: - De segunda a sexta: - - das 8:00 as 12:00 - - das 13:30 as 18:00 -- 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 -- 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 component WITHOUT ACL blocks every controller action
Probably a more correct way could be function isAuthorized(){ return $this-Auth-user(); } Il 18/04/2012 00:24, jeremyharris ha scritto: Setting $this-Auth-authorize = array('Controller'); tells the AuthComponent where to run the `isAuthorized()` method, in this case, the Controller. You can find more info here: http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#using-controllerauthorize On Tuesday, April 17, 2012 2:45:56 PM UTC-7, DigitalDude wrote: Hey, h as I changed the code to the snippet of stork, it gave me a ... function isAuthorized() on a non-object (auth-component line 52). When I added the code of luca capra, everything is working as expected. All actions that are not allowed by $this-Auth-allow() within beforeFilter-functions of my controllers are blocked when not logged in. When logged in, I can use those actions. Thank you very much, both of you. It's still weird about the error with the auth-component and the isAuthorized() function, but as it now works I will go deeper into the code of the Auth component later. If anyone has an explanation for this, it would be great to discuss it! Again, thank you very much, that saved me a lot of time! Regards, DD On 17 Apr., 16:03, stork lubomir.st...@gmail.com wrote: $this-Auth-authorize = 'controllers'; $this-Auth-authorize = array('Controller'); -- 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 -- 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
Auth component WITHOUT ACL blocks every controller action
Hey, I have a little problem with the Auth component. Normally I use it together with ACL, everything works finde. Now I have a really small Project and I just want to have some authentication without ACL tables or different roles. The basic setup is like the following: AppController $components = array('Auth', 'Session', ...); $this-currentUser = $this-Auth-user(); $this-isAuthed = !empty($this-currentUser); $this-Auth-authorize = 'controllers'; $this-Auth-loginAction = array('controller' = 'users', 'action' = 'login'); $this-Auth-loginRedirect = '/'; $this-Auth-logoutRedirect = '/'; $this-Auth-loginError = 'Login failed!'; $this-Auth-authError = 'Please login to see the contents of the site!'; $this-Auth-userScope = array( 'deleted' = 0, 'status' = 2 ); Login and Logout are working fine. I have all data for the user within the session after a login. BUT when I try to open any other action besides login/logout or actions like index within a controller forms, (forms/index) I am redirected to the page before without any messae. I have no access to the actions anymore, no matter if I'm logged in or not. What am I missing here? I do NOT want to use $this-Auth-allow() because it makes the actions accessible for EVERYONE and that is what I am trying to cover... -- 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 component WITHOUT ACL blocks every controller action
Il 17/04/2012 15:13, DigitalDude ha scritto: Hey, I have a little problem with the Auth component. Normally I use it together with ACL, everything works finde. Now I have a really small Project and I just want to have some authentication without ACL tables or different roles. ... What am I missing here? I do NOT want to use $this-Auth-allow() because it makes the actions accessible for EVERYONE and that is what I am trying to cover... I think this should works: // AppController::beforeFilter() if($this-Auth-user()) $this-Auth-allow(); else $this-Auth-deny(); -- 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 component WITHOUT ACL blocks every controller action
$this-Auth-authorize = 'controllers'; $this-Auth-authorize = array('Controller'); -- 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 component WITHOUT ACL blocks every controller action
Hey, h as I changed the code to the snippet of stork, it gave me a ... function isAuthorized() on a non-object (auth-component line 52). When I added the code of luca capra, everything is working as expected. All actions that are not allowed by $this-Auth-allow() within beforeFilter-functions of my controllers are blocked when not logged in. When logged in, I can use those actions. Thank you very much, both of you. It's still weird about the error with the auth-component and the isAuthorized() function, but as it now works I will go deeper into the code of the Auth component later. If anyone has an explanation for this, it would be great to discuss it! Again, thank you very much, that saved me a lot of time! Regards, DD On 17 Apr., 16:03, stork lubomir.st...@gmail.com wrote: $this-Auth-authorize = 'controllers'; $this-Auth-authorize = array('Controller'); -- 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 component WITHOUT ACL blocks every controller action
Setting $this-Auth-authorize = array('Controller'); tells the AuthComponent where to run the `isAuthorized()` method, in this case, the Controller. You can find more info here: http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#using-controllerauthorize On Tuesday, April 17, 2012 2:45:56 PM UTC-7, DigitalDude wrote: Hey, h as I changed the code to the snippet of stork, it gave me a ... function isAuthorized() on a non-object (auth-component line 52). When I added the code of luca capra, everything is working as expected. All actions that are not allowed by $this-Auth-allow() within beforeFilter-functions of my controllers are blocked when not logged in. When logged in, I can use those actions. Thank you very much, both of you. It's still weird about the error with the auth-component and the isAuthorized() function, but as it now works I will go deeper into the code of the Auth component later. If anyone has an explanation for this, it would be great to discuss it! Again, thank you very much, that saved me a lot of time! Regards, DD On 17 Apr., 16:03, stork lubomir.st...@gmail.com wrote: $this-Auth-authorize = 'controllers'; $this-Auth-authorize = array('Controller'); -- 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 Component CakePHP 2.0
Hi Ahmed, thanks a lot for your help. My array looks like this now, but it doesn't work better. public $components = array( 'Acl', 'Auth' = array( 'authorize' = array( 'Actions' = array('actionPath' = 'controllers') ), 'authenticate ' = array( 'Form' = array( 'Fields' = array( 'username' = 'email_address', 'password' = 'password' ) ) ) ), 'Session' ); I'm still being kicked when I try to log in. -- 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 Component CakePHP 2.0
It actually worked with 'fields'. thanks for your help :) -- 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 Component CakePHP 2.0
Hello, you may try to Fields variable in Auth array. instead of : 'authentificate' = array( 'Form' = array( 'username' = 'email_address', 'password' = 'password' ) ) try this: 'authentificate' = array( 'Form' = array( 'Fields' = array( 'username' = 'email_address', 'password' = 'password' ) ) ) Thanks -- 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 Component CakePHP 2.0
one more correction, it's authenticate not authentificate. good luck -- 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
Auth Component CakePHP 2.0
Hi everyone, I started to learn CakePHP recently and followed the ACL tutorial step by step, trying to understand every single piece of it. Sadly, I couldn't achieve it correctly since my app doesn't work. Indeed, I can't log in. Every time, it says that my user name or password is incorrect (while it should be correct). I don't login with User.username and User.password but with User.email_address and User.password. Therefore my AppController: public $components = array( 'Acl', 'Auth' = array( 'authorize' = array( 'Actions' = array('actionPath' = 'controllers') ), 'authentificate' = array( 'Form' = array( 'username' = 'email_address', 'password' = 'password' ) ) ), 'Session' ); And in my UsersController: public function login() { if ($this-Session-read('Auth.User')) { $this-Session-setFlash('You are logged in!'); $this-redirect('/', null, false); } if ($this-request-is('post')) { if ($this-Auth-login()) $this-redirect($this-Auth-redirect()); else $this-Session-setFlash('Your email address or password was incorrect.'); } } I'm being careful and my password is encrypted in MD5 in my User model public function beforeSave() { $this-data['User']['password'] = AuthComponent::password($this- data['User']['password']); return true; } If always ends in Your email address or password was incorrect. and I can't figure out what I did wrong. It's frustrating, I find the tutorial very abstruse on some important points as I'd like to understand how it works. Thank you in advance for your help. -- 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 2.0.5 Auth component problem.
Most probably you have trailing whitespace before of after the php tags in your classes. Use the DebugKit whitespace shell to remove them. You may also want to change the session settings in core.php, usually setting 'checkAgent' = false solves some issues. -- 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 2.0.5 Auth component problem.
I made a basic login, authorization script with cakephp 2.0.5 using Auth component. When I use Firefox to test the aplication everithing works fine both on windows WAMP and on a virtualbox lamp (ubuntu). However when I try to test the aplication with google chrome or Internet explorer it works only on WAMP. On Ubuntu LAMP box it dose not work. I like not beeing able to save the cookie. When I try to login i dose not work and server create a ne session file every time I try to login. This new sesion creation dose not happen if I use Firefox an I am also able to see the set up cookie. I use the latest stable browser versions. Please help me out. It seems like Chrome is not able to set up the cookie right. -- 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 Component problem
I have followed this tutorial and now it's working! Thank you. On 11 jan, 14:14, Tilen Majerle tilen.maje...@gmail.com wrote: http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-examp... check this it was some changes created :) -- Lep pozdrav, Tilen Majerlehttp://majerle.eu 2012/1/11 Glauco Custódio glauco.custo...@gmail.com Hi there, I am migrating my base app from 1.3x to 2.0.5. I have copied a lot of my code and I am changing where is necessary... Auth component is configured, but it is allowing any username/password to log in and message of invalid username is not appearing. Link to my code:http://bin.cakephp.org/view/416619310 Please help me, thank you. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organd 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 athttp://groups.google.com/group/cake-php -- 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
Auth Component problem
Hi there, I am migrating my base app from 1.3x to 2.0.5. I have copied a lot of my code and I am changing where is necessary... Auth component is configured, but it is allowing any username/password to log in and message of invalid username is not appearing. Link to my code: http://bin.cakephp.org/view/416619310 Please help me, thank you. -- 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 Component problem
http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html check this it was some changes created :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/1/11 Glauco Custódio glauco.custo...@gmail.com Hi there, I am migrating my base app from 1.3x to 2.0.5. I have copied a lot of my code and I am changing where is necessary... Auth component is configured, but it is allowing any username/password to log in and message of invalid username is not appearing. Link to my code: http://bin.cakephp.org/view/416619310 Please help me, thank you. -- 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 -- 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 component troubles
Hi, I think there is nothing wrong in your code, but probably your missing something like public function login(){ if ($this-Auth-login()) { $this-redirect($this-Auth-redirect()); } else { $this-Session-setFlash(__('Invalid username or password, try again')); } } in your User controller. You could use that declaration in app controller, which is more compact: class AppController extends Controller { var $components = array( 'Auth' = array( 'fields'=array( 'username' = 'email', 'password' = 'password' ), 'loginError' = Wrong! ) ); function beforeFilter() { } } Hope this help Luca Il 27/12/2011 08:01, Clint ha scritto: class AppController extends Controller { var $components = array('Auth'); function beforeFilter() { $this-Auth-fields = array( 'username' = 'email', 'password' = 'password' ); $this-Auth-loginError = Wrong!; } -- 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 component troubles
Thanks for your suggestions Luca. After looking at my code again this morning, I discovered my mistake. Somehow I'd given App_Controller a ctp extension.. doh! Explains why it wasn't being read. Clint Hi, I think there is nothing wrong in your code, but probably your missing something like public function login(){ if ($this-Auth-login()) { $this-redirect($this-Auth-redirect()); } else { $this-Session-setFlash(__('Invalid username or password, try again')); } } in your User controller. You could use that declaration in app controller, which is more compact: class AppController extends Controller { var $components = array( 'Auth' = array( 'fields'=array( 'username' = 'email', 'password' = 'password' ), 'loginError' = Wrong! ) ); function beforeFilter() { } } Hope this help Luca Il 27/12/2011 08:01, Clint ha scritto: class AppController extends Controller { var $components = array('Auth'); function beforeFilter() { $this-Auth-fields = array( 'username' = 'email', 'password' = 'password' ); $this-Auth-loginError = Wrong!; } -- 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
Auth component troubles
I'm having troubles with the Auth component using CakePHP 1.3 I expected the following to work: ?php class AppController extends Controller { var $components = array('Auth'); function beforeFilter() { $this-Auth-fields = array( 'username' = 'email', 'password' = 'password' ); $this-Auth-loginError = Wrong!; } } ? ?php class UsersController extends AppController { var $name = 'Users'; function login() { } function logout() { $this-redirect($this-Auth-logout()); } } ? Yet it won't authenticate correctly until I move the beforeFilter() from AppController and put it in the UsersController, along with adding var $components = array('Auth'); which the Cake Book says: Not necessary if declared in your app controller which appears to be incorrect. I want to declare all the Auth variables in the AppController so that they're site-wide, but it doesn't work when I do. Any suggestions one what I've done wrong? Thanks! Clint -- 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: Remember Me with Cookie and Auth Component
Hi Miles, I cannot get the component to work, so I switched back to my own cookie login method. I can successfully login the user with the cookie, however, I only have the email address and password available. Is there anyway that i can initialize the user after he logged in? When i debug $this-Auth-user() I get: email = 'f...@bar.com', password = 'foobar' I would like to add all the additional fields in my DB to the user object. Thanks, Jordy -- 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 component not returning user data on manual login (CakePHP 2.0.3)
Ah, that did the trick. Thanks! On Nov 28, 12:43 pm, elitalon elita...@gmail.com wrote: According to documentation (http://api20.cakephp.org/class/auth- component#method-AuthComponentlogin) if you login a user with a custom array, only the information in that array is populated in AuthComponent. Thus, if you want to retrieve the ID you must ensure that the ID is present in `$data['User]`. If you're manually login a user after creating it in a POST request you can use this after saving the user: $this-request-data['User']['id'] = $this-User-id; $this-Auth-login($this-request-data['User']); On Nov 28, 7:08 am, Pratz_ pratyushmit...@gmail.com wrote: I tried doing: $this-Auth-login($data['User']); It too successfully logins the user, but the user data is still not accessible via Auth component. $this-Auth-user('id') still returns NULL. On Nov 25, 12:01 pm, elitalon elita...@gmail.com wrote: If `$data` is an array built like as if it was the result of a `find('first')`, i.e. indexed by your user model name, try using `$this-Auth-login($data['User'])` instead of `$this-Auth-login($data)` On Nov 24, 7:42 am,Pratz_pratyushmit...@gmail.com wrote: Hi, I have been trying to manually login a user in version 2.0.3 using: $this-Auth-login($data). Though it successfully logins the user, and can read user data through $this-Session-read('Auth.User.id'), the Auth Component does not return the user data. $this-Auth-user('id') returns NULL. Thus login through cookies [using remember me] or automatic logging in of a newly created user does not work. May be I am doing something wrong, please provide some leads. Thanks, Pratz_ -- 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 component not returning user data on manual login (CakePHP 2.0.3)
I tried doing: $this-Auth-login($data['User']); It too successfully logins the user, but the user data is still not accessible via Auth component. $this-Auth-user('id') still returns NULL. On Nov 25, 12:01 pm, elitalon elita...@gmail.com wrote: If `$data` is an array built like as if it was the result of a `find('first')`, i.e. indexed by your user model name, try using `$this-Auth-login($data['User'])` instead of `$this-Auth-login($data)` On Nov 24, 7:42 am,Pratz_pratyushmit...@gmail.com wrote: Hi, I have been trying to manually login a user in version 2.0.3 using: $this-Auth-login($data). Though it successfully logins the user, and can read user data through $this-Session-read('Auth.User.id'), the Auth Component does not return the user data. $this-Auth-user('id') returns NULL. Thus login through cookies [using remember me] or automatic logging in of a newly created user does not work. May be I am doing something wrong, please provide some leads. Thanks, Pratz_ -- 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 component not returning user data on manual login (CakePHP 2.0.3)
According to documentation (http://api20.cakephp.org/class/auth- component#method-AuthComponentlogin) if you login a user with a custom array, only the information in that array is populated in AuthComponent. Thus, if you want to retrieve the ID you must ensure that the ID is present in `$data['User]`. If you're manually login a user after creating it in a POST request you can use this after saving the user: $this-request-data['User']['id'] = $this-User-id; $this-Auth-login($this-request-data['User']); On Nov 28, 7:08 am, Pratz_ pratyushmit...@gmail.com wrote: I tried doing: $this-Auth-login($data['User']); It too successfully logins the user, but the user data is still not accessible via Auth component. $this-Auth-user('id') still returns NULL. On Nov 25, 12:01 pm, elitalon elita...@gmail.com wrote: If `$data` is an array built like as if it was the result of a `find('first')`, i.e. indexed by your user model name, try using `$this-Auth-login($data['User'])` instead of `$this-Auth-login($data)` On Nov 24, 7:42 am,Pratz_pratyushmit...@gmail.com wrote: Hi, I have been trying to manually login a user in version 2.0.3 using: $this-Auth-login($data). Though it successfully logins the user, and can read user data through $this-Session-read('Auth.User.id'), the Auth Component does not return the user data. $this-Auth-user('id') returns NULL. Thus login through cookies [using remember me] or automatic logging in of a newly created user does not work. May be I am doing something wrong, please provide some leads. Thanks, Pratz_ -- 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: ACL group based permission + Auth Component
Here is my situation: I have 4 groups: - Administrator - Station Manager - Station DJ - Basic User They all have different permissions to different pages. But no individual user has special permissions outside his/her group. I have read through the cakephp documentation a few times now. I originally leaned towards ACL after first reading the cookbook. But I am noticing now it may be better to simply build in the permissions into the auth component using isAuthorized(). This I imagine would increase speed and performance on my site. On Nov 24, 9:19 am, José Lorenzo jose@gmail.com wrote: It is possible via creating a custom Authorization object, those objects act as plugins for the AuthComponent so you would not need any changes in the usual way you work with Auth. The main question is, do you really need ACL? I've seen lots of people wondering about ACL and after a short talk they realize that ACL might not be the best solution for them. Can you clarify your needs? -- 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: ACL group based permission + Auth Component
It is possible via creating a custom Authorization object, those objects act as plugins for the AuthComponent so you would not need any changes in the usual way you work with Auth. The main question is, do you really need ACL? I've seen lots of people wondering about ACL and after a short talk they realize that ACL might not be the best solution for them. Can you clarify your needs? -- 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
Auth component not returning user data on manual login (CakePHP 2.0.3)
Hi, I have been trying to manually login a user in version 2.0.3 using: $this-Auth-login($data). Though it successfully logins the user, and can read user data through $this-Session-read('Auth.User.id'), the Auth Component does not return the user data. $this-Auth-user('id') returns NULL. Thus login through cookies [using remember me] or automatic logging in of a newly created user does not work. May be I am doing something wrong, please provide some leads. Thanks, Pratz_ -- 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 component not returning user data on manual login (CakePHP 2.0.3)
If `$data` is an array built like as if it was the result of a `find('first')`, i.e. indexed by your user model name, try using `$this-Auth-login($data['User'])` instead of `$this-Auth-login($data)` On Nov 24, 7:42 am, Pratz_ pratyushmit...@gmail.com wrote: Hi, I have been trying to manually login a user in version 2.0.3 using: $this-Auth-login($data). Though it successfully logins the user, and can read user data through $this-Session-read('Auth.User.id'), the Auth Component does not return the user data. $this-Auth-user('id') returns NULL. Thus login through cookies [using remember me] or automatic logging in of a newly created user does not work. May be I am doing something wrong, please provide some leads. Thanks, Pratz_ -- 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
ACL group based permission + Auth Component
Can you use the ACL group based permission and the Auth Component with controller based permissions at the same time? Or were they meant to be used separately? And if you can use them together, which takes precedence in the order of operations? -- 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
Remember Me with Cookie and Auth Component
Hi all, I'm trying to add a remember me checkbox into my login form. When users check the box, they log in and a cookie ('Auth.User') is stored, with 'email' and 'password' fields (this works). Now in my AppController, I want to see if users can log back in using their cookie. I have the following code: //inside AppController.php public function beforeFilter(){ $cookie = $this-Cookie-read('Auth.User'); if (is_array($cookie) !$this-Auth-user()) { $this-Auth-login($cookie); debug($this-Auth-user()); } } The debug shows me that the user object in Auth contains the email address and password. Is there a way to load all of the additional data into the user object (like firstname, lastname, etc...)? My UsersController contains the following login function: public function login(){ $this-autoRender = false; if($this-request-is('post')){ if($this-Auth-login()){ //see if the remember me cookie has to be set if(!empty($this-request-data) $this-request-data['User'] ['remember_me']){ $cookie = array(); $cookie['email'] = $this-data['User']['email']; $cookie['password'] = $this-data['User']['password']; $this-Cookie-write('Auth.User', $cookie, true, '+2 weeks'); return $this-redirect('../index'); } else{ //we logged in, but the user does not want to have a cookie. return $this-redirect('../index'); } } else { //we tried to log in the user but it failed $this-Session-setFlash($this-Auth-authError); return $this-redirect('../index'); } } if(empty($this-request-data)){ $cookie = $this-Cookie-read('Auth.User'); if(!is_null($cookie)){ echo('we found cookie, now trying to log you in with it'); if($this-Auth-login($cookie)){ $this-Session-delete('Message.auth'); //return $this-redirect('../feed'); } else{ //invalid cookie $this-Cookie-del('Auth.User'); } } else{ //users accesses this page without a cookie return $this-redirect('../index'); } } } Please note that I am very new to CakePHP. Thanks in advance, Jordy -- 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: Remember Me with Cookie and Auth Component
Here you are: https://github.com/milesj/cake-auto_login On Nov 22, 10:23 am, Jordy van Kuijk jvank...@gmail.com wrote: Hi all, I'm trying to add a remember me checkbox into my login form. When users check the box, they log in and a cookie ('Auth.User') is stored, with 'email' and 'password' fields (this works). Now in my AppController, I want to see if users can log back in using their cookie. I have the following code: //inside AppController.php public function beforeFilter(){ $cookie = $this-Cookie-read('Auth.User'); if (is_array($cookie) !$this-Auth-user()) { $this-Auth-login($cookie); debug($this-Auth-user()); } } The debug shows me that the user object in Auth contains the email address and password. Is there a way to load all of the additional data into the user object (like firstname, lastname, etc...)? My UsersController contains the following login function: public function login(){ $this-autoRender = false; if($this-request-is('post')){ if($this-Auth-login()){ //see if the remember me cookie has to be set if(!empty($this-request-data) $this-request-data['User'] ['remember_me']){ $cookie = array(); $cookie['email'] = $this-data['User']['email']; $cookie['password'] = $this-data['User']['password']; $this-Cookie-write('Auth.User', $cookie, true, '+2 weeks'); return $this-redirect('../index'); } else{ //we logged in, but the user does not want to have a cookie. return $this-redirect('../index'); } } else { //we tried to log in the user but it failed $this-Session-setFlash($this-Auth-authError); return $this-redirect('../index'); } } if(empty($this-request-data)){ $cookie = $this-Cookie-read('Auth.User'); if(!is_null($cookie)){ echo('we found cookie, now trying to log you in with it'); if($this-Auth-login($cookie)){ $this-Session-delete('Message.auth'); //return $this-redirect('../feed'); } else{ //invalid cookie $this-Cookie-del('Auth.User'); } } else{ //users accesses this page without a cookie return $this-redirect('../index'); } } } Please note that I am very new to CakePHP. Thanks in advance, Jordy -- 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: Cake 2.0 Auth Component login method
On Thursday, 17 November 2011 01:50:09 UTC+1, huoxito wrote: So it seems I got a stupid question. Sorry folks sometimes I just cant see the sutff Im looking for. Just read the new Auth doc carefully. I realized that theres authenticate and authorize configs but I did not realize why it is ok to authenticate when a user submitts a blank login form or whatever else. Pardon? I pass empty values or values of a user that doesnt exist on the model and it still passes authentication .. why? It doesnt sound weird? Well, you're still not reading the code example in the book. I get it that this works fine $this-Auth-login(). But I really don't get it why $this-Auth-login(whatever shit is submitted passes authentication) always return true. Because that code is silly and what you're saying there is explicitly log whatever shit is submitted passes authentication in as the current user. If there is any clear explanation about that on the docs I'm sorry I just miss it. How about the code? You're confusing login with identify. I don't really understand your issue in that you simply don't pass args to login (ordinarily you never pass arguments to login) as shown in the docs - and it just works. If you pass args to login you are bypassing the identify logic and explicitly logging in whatever arguments you passed as the current user. A contrived example of appropriate use would be .. for example: if (env('WHUTEVAH') === 'some specific value') { $this-Auth-login(array('id' = 0, 'username' = 'Uberadmin')); } I.e. you only do that when you want to say this is the current logged in user not who is the current logged in user AD -- 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: Cake 2.0 Auth Component login method
AD I came into this issue because Im migrating a 1.3 app to Cake 2.0 . And I did pass args to login method on Cake 1.3, I already liked to manually login the user back then, and it only returned true if the data passed was on the db, just like the warning on the new docs says. Anyway I think I get it now. You're right I was confusing stuff. And I was used to the idea that Auth magically took care of both authentication and authorization. ps. I logged in the user manually because I had that situation where a register and a login form appear in a same view. So I had to fake input names on one of the forms, get the values on the controller method, mount a new array and pass the data to the login method. Thanks for helping -- 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: Cake 2.0 Auth Component login method
Hi Thats why I asked the question. Because I read the warning on the doc. Warning - In 2.0 $this-Auth-login($this-request-data) will log the user in with whatever data is posted -- 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: Cake 2.0 Auth Component login method
On Wednesday, 16 November 2011 19:29:54 UTC+1, huoxito wrote: Hi Thats why I asked the question. Because I read the warning on the doc. Did you, you know, read the rest of it? AD -- 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: Cake 2.0 Auth Component login method
So it seems I got a stupid question. Sorry folks sometimes I just cant see the sutff Im looking for. Just read the new Auth doc carefully. I realized that theres authenticate and authorize configs but I did not realize why it is ok to authenticate when a user submitts a blank login form or whatever else. I pass empty values or values of a user that doesnt exist on the model and it still passes authentication .. why? It doesnt sound weird? I get it that this works fine $this-Auth-login(). But I really don't get it why $this-Auth-login(whatever shit is submitted passes authentication) always return true. If there is any clear explanation about that on the docs I'm sorry I just miss it. Should be looking into the core class to study it and try to understand it better when I get a break. -- 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