// Define Auth Component in AppController class AppController extends Controller { public $components = array( 'Session', 'Auth' => array( 'loginRedirect' => array( 'controller' => 'users', // Redirect URL after login action 'action' => 'index'), 'logoutRedirect' => array( 'controller' => 'users', // Redirect URL after logout action 'action' => 'login'), 'authError' =>'', 'authenticate' => array( 'Form' => array( 'fields' => array('username' => 'email') // By default Auth components takes username ) ) ) ); } // Define Login & logout function in UsersController class UsersController extends AppController { public function beforeFilter() { parent::beforeFilter(); // Allow users to register and logout. $thi...
Coding Cheatsheets - Learn web development code and tutorials for Software developers which will helps you in project. Get help on JavaScript, PHP, XML, and more.