PHP Class amnah\yii2\user\controllers\AuthController

Inheritance: extends yii\web\Controller
Show file Open project: amnah/yii2-user

Public Properties

Property Type Description
$module amnah\yii2\user\Module

Public Methods

Method Description
actions ( )
connectCallback ( BaseClient $client ) : Response Connect social auth to the logged-in user
loginRegisterCallback ( BaseClient $client ) : Response Login/register via social auth

Protected Methods

Method Description
attemptLogin ( BaseClient $client ) : boolean Attempt to log user in by checking if $userAuth already exists in the db, or if a user already has the email address
doubleCheckUsername ( User $user, string $fallbackUsername ) : mixed Double checks username to ensure that it isn't already taken. If so, revert to fallback
initUserAuth ( BaseClient $client ) : amnah\yii2\user\models\UserAuth Initialize a userAuth model based on $client data. Note that we don't set user_id yet because that can either be the currently logged in user OR a user matched by email address
registerAndLoginUser ( BaseClient $client, amnah\yii2\user\models\UserAuth $userAuth ) Register a new user using client attributes and then associate userAuth
setInfoFacebook ( array $attributes ) : array Set info for facebook registration
setInfoGoogle ( array $attributes ) : array Set info for google registration
setInfoLinkedIn ( array $attributes ) : array Set info for LinkedIn registration
setInfoReddit ( array $attributes ) : array Set info for reddit registration
setInfoTwitter ( array $attributes ) : array Set info for twitter registration
setInfoVkontakte ( array $attributes ) : array Set info for vkontakte registration

Method Details

actions() public method

public actions ( )

attemptLogin() protected method

Attempt to log user in by checking if $userAuth already exists in the db, or if a user already has the email address
protected attemptLogin ( BaseClient $client ) : boolean
$client yii\authclient\BaseClient
return boolean

connectCallback() public method

Connect social auth to the logged-in user
public connectCallback ( BaseClient $client ) : Response
$client yii\authclient\BaseClient
return yii\web\Response

doubleCheckUsername() protected method

Double checks username to ensure that it isn't already taken. If so, revert to fallback
protected doubleCheckUsername ( User $user, string $fallbackUsername ) : mixed
$user amnah\yii2\user\models\User
$fallbackUsername string
return mixed

initUserAuth() protected method

Initialize a userAuth model based on $client data. Note that we don't set user_id yet because that can either be the currently logged in user OR a user matched by email address
protected initUserAuth ( BaseClient $client ) : amnah\yii2\user\models\UserAuth
$client yii\authclient\BaseClient
return amnah\yii2\user\models\UserAuth

loginRegisterCallback() public method

Login/register via social auth
public loginRegisterCallback ( BaseClient $client ) : Response
$client yii\authclient\BaseClient
return yii\web\Response

registerAndLoginUser() protected method

Register a new user using client attributes and then associate userAuth
protected registerAndLoginUser ( BaseClient $client, amnah\yii2\user\models\UserAuth $userAuth )
$client yii\authclient\BaseClient
$userAuth amnah\yii2\user\models\UserAuth

setInfoFacebook() protected method

Set info for facebook registration
protected setInfoFacebook ( array $attributes ) : array
$attributes array
return array [$user, $profile]

setInfoGoogle() protected method

Set info for google registration
protected setInfoGoogle ( array $attributes ) : array
$attributes array
return array [$user, $profile]

setInfoLinkedIn() protected method

Set info for LinkedIn registration
protected setInfoLinkedIn ( array $attributes ) : array
$attributes array
return array [$user, $profile]

setInfoReddit() protected method

Set info for reddit registration
protected setInfoReddit ( array $attributes ) : array
$attributes array
return array [$user, $profile]

setInfoTwitter() protected method

Set info for twitter registration
protected setInfoTwitter ( array $attributes ) : array
$attributes array
return array [$user, $profile]

setInfoVkontakte() protected method

Set info for vkontakte registration
Author: Ilya Sheershoff ([email protected])
protected setInfoVkontakte ( array $attributes ) : array
$attributes array
return array [$user, $profile]

Property Details

$module public property

public Module,amnah\yii2\user $module
return amnah\yii2\user\Module