开发者

CakePHP - Two types of users to authenticate

I would like 开发者_StackOverflowto 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?


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');
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜