maymeow / cakephp-identity
Identity plugin for CakePHP
Installs: 110
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
- cakephp/cakephp: ^3.5
Requires (Dev)
- phpunit/phpunit: ^5.7.14|^6.0
This package is auto-updated.
Last update: 2020-05-31 12:58:49 UTC
README
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require maymeow/cakephp-identity
Configuration
Load plugin in Application.php
with
$this->addPlugin('Identity', ['bootstrap' => false, 'routes' => true]);
Add to AppController.php
following code
$this->loadComponent('Auth', [ //'authorize'=> 'Controller', 'authenticate' => [ 'Form' => [ 'userModel' => 'Identity.Users', // use this to change default auth model 'fields' => [ 'username' => 'email', 'password' => 'password' ] ] ], 'loginAction' => [ 'controller' => 'Users', 'action' => 'login', 'plugin' => 'Identity', 'prefix' => false ], // If unauthorized, return them to page they were just on 'unauthorizedRedirect' => $this->referer() ]); $this->Auth->deny();