Tutorial :How can I automatically log in a user right after they register in CakePHP?



Question:

I am using cakephp framework to build my application. I want that, whenever a user registers he is automatically logged in and shown a particular page. Please tell me how do I achieve this functionality? using xampp, with php 5.2 and mysql 5.0 on winXP.


Solution:1

Well, it comes down to the following:

  • When your user is registered, store his login credentials
  • Call $this->Auth->login()
  • Redirect to your page

See more info about Auth::login() here:

http://api.cakephp.org/class/auth-component#method-AuthComponentlogin


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »