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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -