update folder location
This commit is contained in:
36
src/User/AuthClient/Facebook.php
Normal file
36
src/User/AuthClient/Facebook.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Da\User\AuthClient;
|
||||
|
||||
use Da\User\Contracts\AuthClientInterface;
|
||||
use yii\authclient\clients\Facebook as BaseFacebook;
|
||||
|
||||
class Facebook extends BaseFacebook implements AuthClientInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return isset($this->getUserAttributes()['email'])
|
||||
? $this->getUserAttributes()['email']
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
38
src/User/AuthClient/GitHub.php
Normal file
38
src/User/AuthClient/GitHub.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Da\User\AuthClient;
|
||||
|
||||
use Da\User\Contracts\AuthClientInterface;
|
||||
use yii\authclient\clients\GitHub as BaseGitHub;
|
||||
|
||||
class GitHub extends BaseGitHub implements AuthClientInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return isset($this->getUserAttributes()['email'])
|
||||
? $this->getUserAttributes()['email']
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return isset($this->getUserAttributes()['login'])
|
||||
? $this->getUserAttributes()['login']
|
||||
: null;
|
||||
}
|
||||
}
|
||||
36
src/User/AuthClient/Google.php
Normal file
36
src/User/AuthClient/Google.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Da\User\AuthClient;
|
||||
|
||||
use Da\User\Contracts\AuthClientInterface;
|
||||
use yii\authclient\clients\Google as BaseGoogle;
|
||||
|
||||
class Google extends BaseGoogle implements AuthClientInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return isset($this->getUserAttributes()['emails'][0]['value'])
|
||||
? $this->getUserAttributes()['emails'][0]['value']
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
36
src/User/AuthClient/LinkedIn.php
Normal file
36
src/User/AuthClient/LinkedIn.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Da\User\AuthClient;
|
||||
|
||||
use Da\User\Contracts\AuthClientInterface;
|
||||
use yii\authclient\clients\LinkedIn as BaseLinkedIn;
|
||||
|
||||
class LinkedIn extends BaseLinkedIn implements AuthClientInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return isset($this->getUserAttributes()['email-address'])
|
||||
? $this->getUserAttributes()['email-address']
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
33
src/User/AuthClient/Twitter.php
Normal file
33
src/User/AuthClient/Twitter.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Da\User\AuthClient;
|
||||
|
||||
use Da\User\Contracts\AuthClientInterface;
|
||||
use yii\authclient\clients\Twitter as BaseTwitter;
|
||||
|
||||
class Twitter extends BaseTwitter implements AuthClientInterface
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return isset($this->getUserAttributes()['screen_name'])
|
||||
? $this->getUserAttributes()['screen_name']
|
||||
: null;
|
||||
}
|
||||
|
||||
public function getEmail()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
50
src/User/AuthClient/VKontakte.php
Normal file
50
src/User/AuthClient/VKontakte.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Da\User\AuthClient;
|
||||
|
||||
use Da\User\Contracts\AuthClientInterface;
|
||||
use Yii;
|
||||
use yii\authclient\clients\VKontakte as BaseVKontakte;
|
||||
|
||||
class VKontakte extends BaseVKontakte implements AuthClientInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $scope = 'email';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->getAccessToken()->getParam('email');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return isset($this->getUserAttributes()['screen_name'])
|
||||
? $this->getUserAttributes()['screen_name']
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function defaultTitle()
|
||||
{
|
||||
return Yii::t('usuario', 'VKontakte');
|
||||
}
|
||||
}
|
||||
53
src/User/AuthClient/Yandex.php
Normal file
53
src/User/AuthClient/Yandex.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Da\User\AuthClient;
|
||||
|
||||
use Da\User\Contracts\AuthClientInterface;
|
||||
use Yii;
|
||||
use yii\authclient\clients\Yandex as BaseYandex;
|
||||
|
||||
class Yandex extends BaseYandex implements AuthClientInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
$emails = isset($this->getUserAttributes()['emails'])
|
||||
? $this->getUserAttributes()['emails']
|
||||
: null;
|
||||
|
||||
if ($emails !== null && isset($emails[0])) {
|
||||
return $emails[0];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return isset($this->getUserAttributes()['login'])
|
||||
? $this->getUserAttributes()['login']
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function defaultTitle()
|
||||
{
|
||||
return Yii::t('usuario', 'Yandex');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user