views:

312

answers:

1

I would like to have two different registrations/logins in the same application. One for companies and one for employees because registering a company requires different information than registering an employee.

Is it possible to use the auth component to achieve two different registrations/logins?

+2  A: 

You can dynamically change the AuthComponent's configuration in a beforeFilter(). For example:

function beforeFilter() {
    if (/* company login required */) {
        $this->Auth->userModel = 'Company';
        // or:
        $this->Auth->userScope = array('User.type' => 'company');
    }
}
deceze