为了学习cakephp,我试图重现菜谱的简单验证示例; http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html
我的问题是,当我尝试访问一个非授权页面时,我得到一个空白页面,其中包含蛋糕安装通知警告:请更改secruity salt和cipherSeed的valie
这是我的appcontroller代码
class AppController extends Controller {
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array('controller' => 'posts', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'pages', 'action' => 'display', 'home')
),
'RequestHandler'
);
public function beforeFilter() {
$this->Auth->allow('index', 'view', 'login');
$this->Auth->authorize = 'actions';
$this->Auth->autoRedirect = true;
}
} 这是我的usercontroller代码
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('add');
}
public function login() {
echo "i am called";
if ($this->request->is('post')) {
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect());
} else {
$this->Session->setFlash(__('Invalid username or password, try again'));
}
}
}
public function logout() {
$this->redirect($this->Auth->logout());
}
是否有任何我不做的配置或任何关于auth实现的误解问题?
我使用easyPhp for windows作为我的网络服务器,但我也在使用php5,mysql和apache 2的linux安装上遇到了问题
答案 0 :(得分:1)
在app / Config / core.php中找到密码和盐,你必须更改它们