CakeDC 用户插件 - 有文档吗?

发布于 2024-11-17 10:31:05 字数 499 浏览 3 评论 0原文

浏览GitHub,我发现了一个非常强大的名为 CakeDC Users 的 CakePHP 插件,具有许多用于创建登录/身份验证系统的功能(帐户验证、密码重置等)。我喜欢它,因为它似乎是由一些实际的 CakePHP 开发人员编写的,并且更新了很多,但似乎在任何地方都没有绝对的文档。我最近刚刚遇到这个插件,因为我试图看看是否有比用我自己的解决方案“滚动”更好的方法。所以我想知道这里是否有人有过这方面的经验,如果有的话可以指出一些不错的在线文档。

编辑自述文件底部有一些内容,但对我来说不太直观。

另一个问题,如果您不使用此插件,您在 CakePHP 中是否有用于登录/身份验证的登录/身份验证插件?

Browsing through GitHub and I found a pretty powerful CakePHP plugin called CakeDC Users that has a lot of features (Account verification, password reset, etc) for a creating a login/authentication system. I like it because it seems to be written by some of the actual CakePHP developers and it gets updated a lot but there seems to be absolutely zero documentation anywhere on it. I've just come across this plugin recently, since I was trying to see if there's a better way than "rolling" with my own solution. So I was wondering if anybody here has had experience with it and if so could point to some decent documentation online.

Edit There is some stuff at the bottom of the readme, but it hasn't been too intuitive for me.

Alternate question, if you don't use this plugin, is there a login/authentication plugin you use in CakePHP that you use for login/authentication?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你是暖光i 2024-11-24 10:31:05

我在使用 CakeDC 插件时遇到了同样的问题,其中很多插件很少/没有文档。

但是,它没有“零”文档,您可以在 自述文件中的 github 页面。您还需要将其放入 AppController::beforeFilter() 方法中。

$this->Auth->authorize = 'controller';
$this->Auth->fields = array('username' => 'email', 'password' => 'passwd');
$this->Auth->loginAction = array('plugin' => 'users', 'controller' => 'users', 'action' => 'login', 'admin' => false);
$this->Auth->loginRedirect = '/';
$this->Auth->logoutRedirect = '/';
$this->Auth->authError = __('Sorry, but you need to login to access this location.', true);
$this->Auth->loginError = __('Invalid e-mail / password
combination.  Please try again', true);
$this->Auth->autoRedirect = true;
$this->Auth->userModel = 'User';
$this->Auth->userScope = array('User.active' => 1);
if ($this->Auth->user()) {
    $this->set('userData', $this->Auth->user());
    $this->set('isAuthorized', ($this->Auth->user('id') != ''));
} 

此外,您还需要一个 isAuthorized() 函数,就像这样简单:

public function isAuthorized() {
    return true;
}

此外,您还需要允许“登录”操作(这将涉及编辑插件文件)。只需将“login”添加到 users_controller.php 中的 $this->Auth->allow() 即可。

I have ran into the same problem with using the CakeDC plugins, a lot of them have little/no documentation.

However, there is not "Zero" documentation for it, you can see how to set it up for the most part at the bottom of the github page in the read me. Also you need to put this inside your AppController::beforeFilter() method.

$this->Auth->authorize = 'controller';
$this->Auth->fields = array('username' => 'email', 'password' => 'passwd');
$this->Auth->loginAction = array('plugin' => 'users', 'controller' => 'users', 'action' => 'login', 'admin' => false);
$this->Auth->loginRedirect = '/';
$this->Auth->logoutRedirect = '/';
$this->Auth->authError = __('Sorry, but you need to login to access this location.', true);
$this->Auth->loginError = __('Invalid e-mail / password
combination.  Please try again', true);
$this->Auth->autoRedirect = true;
$this->Auth->userModel = 'User';
$this->Auth->userScope = array('User.active' => 1);
if ($this->Auth->user()) {
    $this->set('userData', $this->Auth->user());
    $this->set('isAuthorized', ($this->Auth->user('id') != ''));
} 

Also, you need an isAuthorized() function, something as simple as this will do:

public function isAuthorized() {
    return true;
}

Additionally, you will need to allow the 'login' action (this will involve editing the plugin files). Just add 'login' to the $this->Auth->allow() in users_controller.php.

云裳 2024-11-24 10:31:05

这个问题现在已经很老了,但由于它没有标记为已解决,而且从那时起我们在文档上做了很多工作,我认为值得更新:

文档可以在这里找到:

对于框架的版本 3+

对于(旧)版本 2

This question is pretty old now, but as it's not marked as resolved and we've been doing a lot on the documentation since then I think it's worth to update:

Documentation can be found here:

For the version 3+ of the framework

For the (old) version 2

总以为 2024-11-24 10:31:05

经过详尽的搜索,我找到了一个关于如何使用 CakeDC 的教程!

这里

After exhaustive search I found a tutorial on how to use CakeDC!

Here it is

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文