努力寻找关于在Cake 2.4中使用Blowfish的几个基本问题的答案.
AppController.php
public $components = array(
'Auth' => array(
'authenticate' => array(
'Form' => array(
'fields' => array(
'username' => 'email'
),
'passwordHasher' => 'Blowfish'
)
)
),
'Cookie',
'Session'
);
Run Code Online (Sandbox Code Playgroud)
现在怎么办?我如何登录?
UsersController.php
public function login() {
if (!empty($this->request->data)) {
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirectUrl());
}
}
}
Run Code Online (Sandbox Code Playgroud)
我还需要添加什么?如果我尝试登录,我收到以下错误:
警告(512):无效盐:对于河豚请访问http://www.php.net/crypt并阅读有关建造河豚盐的相应部分.[CORE/Cake/Utility/Security.php,第285行]
在尝试登录之前是否需要对密码进行加密?如果是,我使用哪种方法以及使用盐最好的方法是什么?Cake会自动尝试为所有用户使用core.php配置文件中的salt 吗?
我很困惑主要是因为我不知道哪些部分使用标准PHP方式使用blowfish,CakePHP正在尝试自动为我做.