Cakedc.users =gt; always redirect to homepage(Cakedc.users =总是重定向到主页)
问题描述
我在新的 Cakephp 安装中使用插件CakeDC/Users".我有两个控制器:PagesController.php、CardsController.php.Pages 有 1 个操作(Beta,这是主页),Cards 有 2 个操作(索引和单项).
I'm using the plugins "CakeDC/Users" on a brain new Cakephp installation. I've got two controllers : PagesController.php, CardsController.php. Pages has 1 action (Beta, it's the homepage), and Cards two actions (index, and single).
这是引导程序中的设置:
Here is the setup in the bootstrap :
Configure::write('Users.config', ['users']);
Plugin::load('CakeDC/Users', ['routes' => true, 'bootstrap' => true]);
以及config/users.php中插件的配置:
And the configuration of the plugin in config/users.php :
return [
'Users' => [
'Email' => [
'validate' => false
]
],
'Auth' => [
'loginAction' => [
'plugin' => null,
'controller' => 'Members',
'action' => 'login',
'prefix' => null
],
'logoutAction' => [
'plugin' => null,
'controller' => 'Members',
'action' => 'logout',
'prefix' => null
],
'authenticate' => [
'all' => [
'finder' => 'auth',
],
'CakeDC/Users.ApiKey',
'CakeDC/Users.RememberMe',
'Form',
],
'authorize' => [
//'CakeDC/Users.Superuser',
//'CakeDC/Users.SimpleRbac',
],
],
];
我只配置了一个路由:
$routes->connect('/', ['controller' => 'Pages', 'action' => 'Beta', 'home']);
这是我的 AppController.php :
And here is my AppController.php :
public function initialize()
{
parent::initialize();
$this->loadComponent('Flash');
$this->loadComponent('CakeDC/Users.UsersAuth');
}
主页被允许:
$this->Auth->allow('beta');
未登录时,我只能访问/pages/beta,没关系.我可以用插件注册、登录和注销,这边没问题.
When not logged in, I can only access /pages/beta, which is ok. I can register, login, and logout with the plugin, no problem on this side.
登录后,除了主页之外,我无法访问任何其他页面.如果我到达/cards/index 或/cards/single,我总是会重定向到主页.如果我禁用了插件,页面访问就可以了.
Once I'm logged, I can't access any other pages than the homepage. If I got to /cards/index, or /cards/single, I'm always redirect to the homepage. If I disabled the plugin, pages access is ok.
我已经坚持了一段时间了,有什么帮助吗?谢谢,最好的问候
I'm stuck on this since a while now, any help ? Thanks, Best Regards
推荐答案
没关系,我已经更换了:
Nevermind, I've replaced :
'authorize' => [
//'CakeDC/Users.Superuser',
//'CakeDC/Users.SimpleRbac',
],
作者:
'authorize' => false,
插件默认使用授权组件,所以如果你不打算使用它,你可以设置false"以确保你没有问题.或者你必须通过设置好的设置来设置授权的控制器和动作.
The plugin used authorize with a component by default, so if you're not going to use it, you have the set "false" to be sure you don't have issues. Or you have to setup the authorized controllers and actions by setting up the good setup.
谢谢,
这篇关于Cakedc.users =>总是重定向到主页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Cakedc.users =>总是重定向到主页
基础教程推荐
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 如何替换eregi() 2022-01-01
