CakePHP身份验证重定向不工作
为了学习cakephp,我试图重现烹饪书中的简单身份验证示例 我的问题是,当我试图访问一个未经授权的页面时,我只得到一个空白页面,上面有蛋糕安装通知警告:请更改安全盐和密码种子的有效期 这是我的appcontroller代码CakePHP身份验证重定向不工作,cakephp,authentication,Cakephp,Authentication,为了学习cakephp,我试图重现烹饪书中的简单身份验证示例 我的问题是,当我试图访问一个未经授权的页面时,我只得到一个空白页面,上面有蛋糕安装通知警告:请更改安全盐和密码种子的有效期 这是我的appcontroller代码 class AppController extends Controller { public $components = array( 'Session', 'Auth' => array( 'loginRedirect' =>
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;
}
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());
}
}
这是我的usercontroller代码
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;
}
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实现有任何误解
我使用Windows的EasyPHP作为我的Web服务器,但我也有一个关于安装PHP5、MySQL和Apache 2
密码和盐的问题,在App/CONFIG/COR.PHP中发现,当你看到空白页时,你必须在浏览器的URL栏中改变它们
,地址是什么?错误告诉你改变密码和盐。这样做。我不知道cakePHP默认通知消息可能会导致错误,但这解决了它,谢谢!!!