CakeDC用户插件 - 是否有文档地方? [英] CakeDC User Plugin - Is there Documentation Anywhere?

查看:150
本文介绍了CakeDC用户插件 - 是否有文档地方?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过浏览 GitHub上以及我发现了一个pretty强大的 CakePHP的插件名为 CakeDC用户 有很多的功能(账户验证,密码重置等)的创建登录/认证系统。我喜欢它,因为它似乎是由一些实际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.

替代问题,如果你不使用这个插件,有一个登录/认证插件,您在CakePHP中使用您使用的登录/验证?

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?

推荐答案

我已经跑与使用CakeDC插件同样的问题,他们中的很多很少有/没有文件。

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

然而,有没有为它零的文档,你可以看到如何设置它大部分在的 github上的阅读我页面。你也需要把这个你的AppController :: beforeFilter()方法中。

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') != ''));
} 

另外,你需要一个 isAuthorized()函数,东西这么简单就可以了:

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

public function isAuthorized() {
    return true;
}

此外,你需要允许登录行动(这将涉及编辑插件文件)。只需添加登陆到 $这个 - > Auth->允许() users_controller.php中

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.

这篇关于CakeDC用户插件 - 是否有文档地方?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆