CakePHP 2 separate login tables

后端 未结 5 1751
醉梦人生
醉梦人生 2021-01-01 03:24

I have a Cake website and it needs to have two separate logins, each one will have their own login form and see different pages, it would be nice to have two different table

5条回答
  •  长情又很酷
    2021-01-01 03:49

    The simplest way to do this is to just set a different session key for each login type:

    if ($loginTypeOne) {
      $this->Auth->authenticate = array(
        'Form'=> array(
          'userModel'=> 'TypeOne',
          )
        );
      AuthComponent::$sessionKey = 'Auth.TypeOne';
    } else {
      $this->Auth->authenticate = array(
        'Form'=> array(
          'userModel'=> 'TypeTwo',
          )
        );
      AuthComponent::$sessionKey = 'Auth.TypeTwo';  
    }
    

提交回复
热议问题