我的AppController
-
App::uses('Controller', 'Controller');
/**
* Application Controller
*
* Add your application-wide methods in the class below, your controllers
* will inherit them.
*
* @package app.Controller
* @link http://book.cakephp.org/2.0/en/controllers.html#the-app-controller
*/
class AppController extends Controller
{
// Pass settings in $components array
public $components = array(
'Auth' => array(
'loginAction' => array(
'controller' => 'users',
'action' => 'login',
),
'authError' => 'You are not permitted for this action.',
'authenticate' => array(
'Form' => array(
'fields' => array('username' => 'email')
),
'passwordHasher' => 'Blowfish'
),
'Session',
)
);
我的User
模特。 -
App::uses('BlowfishPasswordHasher', 'Controller/Component/Auth');
/**
* This is a "Docblock Comment," also known as a "docblock." The class'
* docblock, below, contains a complete description of how to write these.
*/
class User extends AppModel
{
但我收到错误 - AUTHENTICATION ADAPTER "PASSWORDHASHER" WAS NOT FOUND
。
不知道原因。可能是什么问题?
答案 0 :(得分:1)
阵列中有拼写错误。您的Authenticate密钥应为:
'authenticate' => array(
'Form' => array(
'fields' => array('username' => 'email'),
'passwordHasher' => 'Blowfish'
),
),
authenticate
数组键包含一组身份验证机制。您得到的错误是因为CakePHP认为存在名为passwordHasher
的身份验证系统。