shreenu/yii2-usermanagement

yii2 user management

dev-master 2016-01-02 09:44 UTC

This package is not auto-updated.

Last update: 2024-11-13 19:21:33 UTC


README

Yii2 User Management

Installation

The preferred way to install this extension is through composer.

Either run

composer require shreenu/yii2-usermanagement

or add

"shreenu/yii2-usermanagement": "*"

to the require section of your composer.json file.

and run

composer update

Usage

change your configuration file.

'components' => [
    'user'=> [
                'identityClass' => \shreenu\usermanagement\models\User::className(),
                'enableAutoLogin' => true,
    ],
]
'modules'=> [
    'usermanagement'=>[
        'class' => \shreenu\usermanagement\usermanagementModule::className(),
    ],
],

Login and Logout URLs:

Change your menu code

Yii::$app->user->isGuest ?
['label' => 'Login', 'url' => ['/usermanagement/user/login']] :
[
    'label' => 'Logout (' . Yii::$app->user->identity->username . ')',
    'url' => ['/usermanagement/user/logout'],
    'linkOptions' => ['data-method' => 'post']
],