implemented social identities management page + pw editing page. probably need to fix backend

This commit is contained in:
2018-07-25 23:07:11 +02:00
parent 57911377ef
commit 2e075799f2
35 changed files with 541 additions and 301 deletions
@@ -21,6 +21,11 @@ class FacebookProvider extends OAuth2Provider
'timezone',
];
protected function providerName()
{
return 'facebook';
}
protected function getAuthorizeUrl()
{
return $this->authorizeUrl;
@@ -24,6 +24,11 @@ class GitHubProvider extends OAuth2Provider
],
];
protected function providerName()
{
return 'github';
}
protected function getAuthorizeUrl()
{
return $this->authorizeUrl;
@@ -21,6 +21,11 @@ class GoogleProvider extends OAuth2Provider
'user_details' => [],
];
protected function providerName()
{
return 'google';
}
protected function compileScopes()
{
return implode(' ', $this->scope);
@@ -1,6 +1,7 @@
<?php namespace SocialNorm;
/**
* @property-read string $provider
* @property-read string $access_token
* @property-read string $id
* @property-read string $nickname
@@ -12,6 +13,7 @@
*/
class ProviderUser
{
protected $provider;
protected $access_token;
protected $id;
protected $nickname;
@@ -28,6 +30,7 @@ class ProviderUser
$this->full_name = $this->fetch($attributes, 'full_name');
$this->avatar = $this->fetch($attributes, 'avatar');
$this->email = $this->fetch($attributes, 'email');
$this->provider = $this->fetch($attributes, 'provider');
$this->raw = $raw;
}
@@ -44,6 +44,8 @@ abstract class OAuth2Provider implements Provider
return $this->redirectUri;
}
protected abstract function providerName();
public function authorizeUrl(string $state) : string
{
$url = $this->getAuthorizeUrl();
@@ -71,6 +73,7 @@ abstract class OAuth2Provider implements Provider
$this->accessToken = $this->requestAccessToken();
$this->providerUserData = $this->requestUserData();
return new ProviderUser([
'provider' => $this->providerName(),
'access_token' => $this->accessToken,
'id' => $this->userId(),
'nickname' => $this->nickname(),
@@ -29,6 +29,11 @@ class StackOverflowProvider extends OAuth2Provider
'user_details' => [],
];
protected function providerName()
{
return 'stack';
}
public function __construct(array $config, HttpClient $httpClient, Request $request)
{
parent::__construct($config, $httpClient, $request);