Http cakephp仅对基本有效用户进行身份验证
我正在使用Auth和authenticate Basic。 是否有方法检查用户是否处于活动状态=1? 我想检查一下表格和基本方法。 当用户通过http头发送用户名和密码从iphone应用程序登录时,使用基本方法Http cakephp仅对基本有效用户进行身份验证,http,cakephp,authentication,Http,Cakephp,Authentication,我正在使用Auth和authenticate Basic。 是否有方法检查用户是否处于活动状态=1? 我想检查一下表格和基本方法。 当用户通过http头发送用户名和密码从iphone应用程序登录时,使用基本方法 public $components = array('Session', 'RequestHandler', 'Auth' => array( 'loginAction' => array( 'controller' => 'a
public $components = array('Session', 'RequestHandler', 'Auth' => array(
'loginAction' => array(
'controller' => 'api',
'action' => 'login'
),
'authenticate' => array(
'Basic' => array(
'userModel' => 'Appuser',
'fields' => array(
'username' => 'name'
)
),
'Form' => array(
'userModel' => 'Appuser',
'fields' => array(
'username' => 'name'
)
)
)
));
使用AuthComponent的
scope
设置,并使用ALL
常量进行设置:
public $components = array(
'Auth' => array(
'loginAction' => array(
'controller' => 'api',
'action' => 'login'
),
'authenticate' => array(
AuthComponent::ALL => array( // Use this to apply common settings
'userModel' => 'Appuser',
'fields' => array(
'username' => 'name'
),
'scope' => array(
'Appuser.active' => 1 // This is the check you need
)
),
'Basic',
'Form'
)
)
);
有关更多信息,请参阅