使用Cakephp 2.5.6密码哈希器获取错误
My使用Cakephp 2.5.6密码哈希器获取错误,php,cakephp,cakephp-2.3,Php,Cakephp,Cakephp 2.3,MyAppController- 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.ca
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',
)
);
和我的用户
型号。-
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
{
但我收到错误-未找到身份验证适配器“PASSWORDHASHER”
。
我找不出原因。可能有什么问题?您的数组中有一个输入错误。您的身份验证密钥应为:
'authenticate' => array(
'Form' => array(
'fields' => array('username' => 'email'),
'passwordHasher' => 'Blowfish'
),
),
authenticate
数组密钥接受一组身份验证机制。您遇到的错误是因为CakePHP认为有一个名为passwordHasher
的身份验证系统,没问题!这是社区在这里要做的事情。