6

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?

Dunhamzzz
  • 14,682
  • 4
  • 50
  • 74
J Lee
  • 1,533
  • 1
  • 14
  • 20
  • Were you able to successfully use this plugin? I am in the same boat....can't find any documentation on how to precisely include this plugin... ran through cake console but nothing works...any tips? – jagamot Jan 01 '12 at 23:37
  • Claiming that there is "zero" documentation is just a proof you did not even spent one minute reading the readme.md... – floriank Sep 17 '13 at 13:05
  • @burzum My question was submitted 2 years ago bud...you don't think things might have changed since then? Regardless, I haven't used this plugin in the past year anyways. Stop trying to be tough. – J Lee Sep 17 '13 at 22:09

3 Answers3

4

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.

Dunhamzzz
  • 14,682
  • 4
  • 50
  • 74
  • Thanks for adding this. I saw the readme, but I wasn't completely clear on what to do there. I understand what its meant to do ( extend the plugin), but I'm unsure on how to go about it – J Lee Jun 24 '11 at 18:27
  • You don't need to extend the plugin, just drop it in and you're away – Dunhamzzz Jun 27 '11 at 08:06
  • It works nice only if I use $this->Auth->authorize = array('Controller'); instead of $this->Auth->authorize = 'controller'; – Guillaume Pommier Jan 18 '14 at 14:30
1

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

Here it is

itamar
  • 3,837
  • 5
  • 35
  • 60
1

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

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
steinkel
  • 1,156
  • 9
  • 15
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Remi Guan Mar 07 '16 at 11:44