2017 © Pedro Peláez
 

yii2-extension yii2-users

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

image

kuzmiand/yii2-users

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

  • Wednesday, November 4, 2015
  • by kuzmiand
  • Repository
  • 1 Watchers
  • 1 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 39 Forks
  • 0 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

Yii2-users

Module for management users and their rights with the support of registration via social services and assigned to each user more than one social service., (*1)

Abilities

User registration and authorization by e-mail and via social networks with the ability to bind several different social networking accounts to a one account on the your site

Authorization widget OAuth keys manage widget, (*2)

Changing password

Changing password, (*3)

Recovering password

Recovering password, (*4)

Changing e-mail. Confirmation will be sent to the old and new address

Changing e-mai, (*5)

Editinig profile

Editinig profile, (*6)

Administation module for manage users

Admin module, (*7)

Editing RBAC structure and user rights via the GUI

Editing RBAC structure, (*8)

Editiong user permissions, (*9)

Installation

The preferred way to install this extension is through composer., (*10)

Either run, (*11)

php composer.phar require --prefer-dist kuzmiand/yii2-users "*"

or add, (*12)

"kuzmiand/yii2-users": "*"

to the require section of your composer.json file., (*13)

Config

'user' => [
    'identityClass' => 'kuzmiand\users\models\User',
    'enableAutoLogin' => true,
    'loginUrl' => ['/login'],
],
'authClientCollection' => [
    'class' => 'yii\authclient\Collection',
    'clients' => [
        'vkontakte' => [
            'class' => 'kuzmiand\users\components\oauth\VKontakte',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
            'scope' => 'email'
        ],
        'google' => [
            'class' => 'kuzmiand\users\components\oauth\Google',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
        ],
        'facebook' => [
            'class' => 'kuzmiand\users\components\oauth\Facebook',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
        ],
        'github' => [
            'class' => 'kuzmiand\users\components\oauth\GitHub',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
            'scope' => 'user:email, user'
        ],
        'linkedin' => [
            'class' => 'kuzmiand\users\components\oauth\LinkedIn',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
        ],
        'live' => [
            'class' => 'kuzmiand\users\components\oauth\Live',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
        ],
        'yandex' => [
            'class' => 'kuzmiand\users\components\oauth\Yandex',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
        ],
        'twitter' => [
            'class' => 'kuzmiand\users\components\oauth\Twitter',
            'consumerKey' => 'XXX',
            'consumerSecret' => 'XXX',
        ],
    ],
],
'urlManager' => [
    'enablePrettyUrl' => true,
    'showScriptName' => false,
    'rules' => [
        '/signup' => '/user/user/signup',
        '/login' => '/user/user/login',
        '/logout' => '/user/user/logout',
        '/requestPasswordReset' => '/user/user/request-password-reset',
        '/resetPassword' => '/user/user/reset-password',
        '/profile' => '/user/user/profile',
        '/retryConfirmEmail' => '/user/user/retry-confirm-email',
        '/confirmEmail' => '/user/user/confirm-email',
        '/unbind/<id:[\w\-]+>' => '/user/auth/unbind',
        '/oauth/<authclient:[\w\-]+>' => '/user/auth/index'
    ],
],
'authManager' => [
    'class' => 'yii\rbac\DbManager',
],

'modules' => [
    'user' => [
        'class' => 'kuzmiand\users\Module',
        'userPhotoUrl' => 'http://example.com/uploads/user/photo',
        'userPhotoPath' => '@frontend/web/uploads/user/photo'
    ],
],

Instead of XXX, you have to use yours values. To receive them, you must create applications on the social networks., (*14)

Client Registration address
vkontakte https://vk.com/editapp?act=create
google https://console.developers.google.com/project
facebook https://developers.facebook.com/apps
github https://github.com/settings/applications/new
linkedin https://www.linkedin.com/secure/developer
live https://account.live.com/developers/applications
yandex https://oauth.yandex.ru/client/new
twitter https://dev.twitter.com/apps/new

If you are using advanced template and Yandex client, then you have to add authClientCollection in configurations for frontend and backend applications. However Yandex client should be added to only one of the applications. The reason for this is that Yandex one application can work with only one domain, you can not add two different Callback URL on different domains., (*15)

Not all services returns all user data. Some of the data get the default settings, if the service does not return them., (*16)

Database migrations

yii migrate/up --migrationPath=@vendor/kuzmiand/yii2-users/migrations, (*17)

This migration create all necessary for the operation of the module tables and two users:, (*18)

E-mail Password
administrator@example.com administrator@example.com
moderator@example.com moderator@example.com

Usage

in main layout:, (*19)

use kuzmiand\users\components\AuthorizationWidget;
<?= AuthorizationWidget::widget() ?>

Signup: http://example.com/signup, (*20)

Profile: http://example.com/profile, (*21)

Restore password: http://example.com/requestPasswordReset, (*22)

Manage users: http://example.com/user/admin, (*23)

Manage RBAC: http://example.com/user/rbac, (*24)

Custom views and email templates

If you want use custom views and email templates you can override their in config. For example:, (*25)

'modules' => [
    'user' => [
        'class' => 'kuzmiand\users\Module',
        'customViews' => [
            'login' => '@app/views/site/login'
        ],
        'customMailViews' => [
            'confirmChangeEmail' => '@app/mail/confirmChangeEmail' //in this case you have to create files confirmChangeEmail-html.php and confirmChangeEmail-text.php in mail folder
        ]
    ],
],

You can override all views from vendor\kuzmiand\yii2-users\views\user and vendor\kuzmiand\yii2-users\mail folders., (*26)

The Versions

04/11 2015

dev-master

9999999-dev

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

  Sources   Download

BSD-3-Clause

The Requires

 

extension oauth yii2 module rbac users

04/11 2015

0.1.9

0.1.9.0

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

  Sources   Download

BSD-3-Clause

The Requires

 

extension oauth yii2 module rbac users

21/07 2015

0.1.8

0.1.8.0

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

  Sources   Download

BSD-3-Clause

The Requires

 

by Sergey Krivochenko

extension oauth yii2 module rbac users

18/07 2015

0.1.7

0.1.7.0

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

  Sources   Download

BSD-3-Clause

The Requires

 

by Sergey Krivochenko

extension oauth yii2 module rbac users

15/07 2015

0.1.6

0.1.6.0

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

  Sources   Download

BSD-3-Clause

The Requires

 

by Sergey Krivochenko

extension oauth yii2 module rbac users

13/07 2015

0.1.5

0.1.5.0

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

  Sources   Download

BSD-3-Clause

The Requires

 

by Sergey Krivochenko

extension oauth yii2 module rbac users

23/06 2015

0.1.4

0.1.4.0

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

  Sources   Download

BSD-3-Clause

The Requires

 

by Sergey Krivochenko

extension oauth yii2 module rbac users

18/06 2015

0.1.3

0.1.3.0

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

  Sources   Download

BSD-3-Clause

The Requires

 

by Sergey Krivochenko

extension oauth yii2 module rbac users

07/06 2015

0.1.2

0.1.2.0

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

  Sources   Download

BSD-3-Clause

The Requires

 

by Sergey Krivochenko

extension oauth yii2 module rbac users

07/06 2015

0.1.1

0.1.1.0

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

  Sources   Download

BSD-3-Clause

The Requires

 

by Sergey Krivochenko

extension oauth yii2 rbac users

07/06 2015

0.1.0

0.1.0.0

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

  Sources   Download

BSD-3-Clause

The Requires

 

by Sergey Krivochenko

extension oauth yii2 rbac users