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

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

问题描述

浏览GitHub,我发现了一个非常强大的CakePHP 插件 CakeDC Users 具有许多功能(帐户验证、密码重置等),用于创建登录/身份验证系统.我喜欢它,因为它似乎是由一些实际的 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;
}

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

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天全站免登陆