Cakedc用户无法加载配置文件

时间:2016-06-03 09:14:45

标签: cakephp-3.0 cakedc

我使用CakeDC's Users插件进行身份验证。 我已按照 here 的说明执行了所有安装步骤,但我收到此错误:

enter image description here

我已执行以下步骤:

  1. composer require cakedc/users
  2. composer require league/oauth2-facebook:@stable
  3. composer require league/oauth2-google:@stable
  4. bin/cake migrations migrate -p CakeDC/Users
  5. 在config / bootstrap.php
  6.     Configure::write('Users.config', ['users']);
        Plugin::load('CakeDC/Users', ['routes' => true, 'bootstrap' => true ]);
        Configure::write('Users.Social.login', true); //to enable social login
    
    1. 在src / Controller / AppController.php中加载Component,然后使用 传递的Component配置来自定义Users Plugin:

      $this->loadComponent('CakeDC/Users.UsersAuth');
      
    2. 更新:我已删除

      Configure::write('Users.config', ['users']);
      

      我的引导程序中的这一行,因为我现在使用默认的users.php文件,该文件存在于插件中。 但我现在得到这个错误:

      Invalid provider or missing class (League\OAuth2\Client\Provider\LinkedIn)
      

      我可以通过禁用社交登录(这不是我想要做的)来摆脱这个错误:

      Configure::write('Users.Social.login', false);
      

      禁用社交登录后,我收到此错误:

      Error: A route matching "array ( 'plugin' => 'CakeDC/Users', 'controller' => 'Users', 'action' => 'login', 'prefix' => false, '_ext' => NULL, )" could not be found.
      

      任何帮助都可以节省我的一天。

2 个答案:

答案 0 :(得分:1)

@ndm是对的,第5步是针对配置,当使用composer进行安装时,删除以下2行修复了迁移步骤之前的错误:

//= require masonry/jquery.masonry

然后在迁移后重新添加这些行以继续安装。

答案 1 :(得分:0)

第5步是自定义 - 检查您已关联的文档中的标题。因此,这实际上不是必需的安装步骤。

问题应该很容易通过命名,您遇到的错误以及堆栈跟踪(只是检查每个框架中正在执行的操作)来确定 - 设置{{1} }用于定义自定义配置文件,您定义的文件不存在(或者不可重复),因此错误。

<asp:GridView ID="gvPersons" runat="server" AutoGenerateColumns="False" Width="100px">

<强> https://github.com/CakeDC/users/blob/3.2.0/config/bootstrap.php#L21-L23

所以要么不这样做,要在别处定义配置(在Users.config配置中,或在任何地方),或者创建缺少的collection((array)Configure::read('Users.config'))->each(function ($file) { Configure::load($file); }); 配置文件并放置用户插件配置在那里。

另见

<强> https://github.com/CakeDC/users/.../Configuration.md#overriding-the-default-configuration

相关问题