maymeow/cakephp-identity

This package is abandoned and no longer maintained. No replacement package was suggested.

Identity plugin for CakePHP

Installs: 110

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:cakephp-plugin

v1.1 2019-04-16 14:14 UTC

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();