When we use Auth component for login in cake php then we are restricted to use 2 column in users table 'password' and 'username' .If we want to use our own column name then follow these steps: Step 1: Include the below function in YoursController.
Step 1:
class Yours Controller extends AppController {
var $components = array('Auth');
function beforeFilter() {
$this->Auth->fields = array(
'username' => 'usersname',
'password' => 'loginpassword'
);
}
}
Here we are using usersname in place of username and loginpassword in place of password.
Step: Accordingly change the name of fields in ctp file of View directory
0 Comment(s)