cakephp - authentication using a different table and column -
how change user table name , column name authentication in cakephp. default taking users table name.
class appcontroller extends controller { public $components = array( 'session','security', 'auth' => array( 'loginredirect' => array('controller' => 'project', 'action' => 'index', 'project details'), 'logoutredirect' => array('controller' => 'users', 'action' => 'login') ) ); function beforefilter() { $this->auth->allow('login'); } }
model :
app::uses('appmodel', 'model'); class users extends appmodel { var $usetable = 'manager'; }
in appcontroller's beforefilter() method add following code
function beforefilter(){ parent::beforefilter(); $this->auth->authenticate = array( authcomponent::all => array("fields" => array("username" => "your_username_column", "password" => "your_password_column") )
); }
Comments
Post a Comment