Skip to main content

Posts

Showing posts with the label Cakephp Auth Components

Cakephp Auth login

// 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...