2017 © Pedro Peláez
 

yii2-extension yii2-user

Yii2 Simple User Module

image

mihaildev/yii2-user

Yii2 Simple User Module

  • Monday, October 24, 2016
  • by mihaildev
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Простая компонента для настройки работы с доступом

Простая авторизация для сайта, (*1)

Установка и Настройка

1) добавляем в composer.json - "mihaildev/yii2-user": "*" 2) замена стандартной компоненты, (*2)


'components' => [ 'user' => [ 'class' => 'mihaildev\user\Component', 'enableAutoLogin' => true, 'loginUrl' => ['/site/login'], //'loginUrl' => ['/user/login'], 'userList' => [ '1' => [// id value 'id' => '1', 'username' => 'admin', 'password' => 'admin', ] ], 'authKeySalt' => 'SomeSecreteValue' ],

3) добавление в контроллер действий, (*3)

class SiteController extends Controller
{
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            'access' => [
                'class' => AccessControl::className(),
                'only' => ['logout'],
                'rules' => [
                    [
                        'actions' => ['logout'],
                        'allow' => true,
                        'roles' => ['@'],
                    ],
                ],
            ],
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'logout' => ['post'],
                ],
            ],
        ];
    }

    public function actions()
    {
        return [
            'login' => [
                'class' => 'mihaildev\user\action\LogIn',
                //'template' => 'login' // default: @mihaildev/user/views/login.php,
                //'defaultUrl' => ['/site/index'],

            ],
            'logout' => 'mihaildev\user\action\LogOut',
        ];
    }

или добавляем контроллер mihaildev\user\Controller, (*4)


'controllerMap' => [ 'user' => [ 'class' => 'mihaildev\user\Controller', //'template' => 'login' // default: @mihaildev/user/views/login.php, //'defaultUrl' => ['/site/index'], ]

The Versions

24/10 2016

dev-master

9999999-dev https://github.com/MihailDev/yii2-user

Yii2 Simple User Module

  Sources   Download

BSD-3-Clause

The Requires

 

user yii2 yii

24/10 2016

v1.0.0

1.0.0.0 https://github.com/MihailDev/yii2-user

Yii2 Simple User Module

  Sources   Download

BSD-3-Clause

The Requires

 

user yii2 yii