Advanced

How to use AuthComponent in Cakephp 1.2

How do you use AuthComponent and AclComponent to authenticate users? On app_controller.php,
put this code:
<?php
class AppController extends Controller {
var $components = array(’Acl’,’Auth’,’Cookie’,’Session’);
function beforeFilter() {
$this->Auth->loginAction = ‘/users/login’;
$this->Auth->loginRedirect = ‘/questions/Various-Topics’;
$this->Auth->authorize = ‘actions’;
}
?>

and, on every controller, create a beforeFilter function and put this :
function beforeFilter() {
//var_dump($this->params);
this->Auth->allow(’action1′,’action2′);
parent::beforeFilter();
}
Note, however , since AuthComponent is authenticating users based on controller actions [...]

Welcome

Welcome to PHPUGPH’s Blog.
In this blog, we will post helpful articles, tips, tricks, know-how and the in-and-out of PHP. It will also be a place of Ideas and collaboration from PHP developers and enthusiasts in the Philippines.
Enjoy reading.