Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Set column name for auth component of users table

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 183
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: