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

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -