From 324eebcbf876cbf43740464ad484edae9716a9e0 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 5 May 2022 14:49:04 +0400 Subject: [PATCH] feat: removed VK since they do not expose email anymore --- app/config/providers.php | 10 -- public/images/users/vk.png | Bin 4198 -> 0 bytes src/Appwrite/Auth/OAuth2/Bitbucket.php | 2 +- src/Appwrite/Auth/OAuth2/Vk.php | 203 ------------------------- src/Appwrite/Auth/OAuth2/Yammer.php | 2 +- 5 files changed, 2 insertions(+), 215 deletions(-) delete mode 100644 public/images/users/vk.png delete mode 100644 src/Appwrite/Auth/OAuth2/Vk.php diff --git a/app/config/providers.php b/app/config/providers.php index 1d364a3fcf..c0acceb0fc 100644 --- a/app/config/providers.php +++ b/app/config/providers.php @@ -241,16 +241,6 @@ return [ // Ordered by ABC. 'beta' => false, 'mock' => false, ], - 'vk' => [ - 'name' => 'VK', - 'developers' => 'https://vk.com/dev', - 'icon' => 'icon-vk', - 'enabled' => true, - 'sandbox' => false, - 'form' => false, - 'beta' => false, - 'mock' => false, - ], 'zoom' => [ 'name' => 'Zoom', 'developers' => 'https://marketplace.zoom.us/docs/guides/auth/oauth/', diff --git a/public/images/users/vk.png b/public/images/users/vk.png deleted file mode 100644 index e3cf2d74ef008705322cee81a7e549a5d416f15f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4198 zcma)A2{@E%|9-8hs^nS_V54zz=yIh zu>qg>&6|rA{N0FRWdi{AI-(txhDBQ;J;?zoI6T>dph6D_1aSb+)u#vIJpBkXhzG%& zNYaB&)!m0ehq7U719c+?4pHVM3sKQiy>xBAEo) z)Wms^gK2tDD2PM8i_?f+Kh;Up@9u+vfNdf$gbEz?pL7D9_z(0=D}aBc6hy@>uGMzt|Ff}l)|H4)mHn#!sw-(if}dL_lRw=!SjH}(QyBZzgg7~UC;uJMp_W5G%_V@YwBC6 z+Y*AljlK>2iCZ-efox?OiSyiyyB;)%qKRO3e#r^|$R!0Qbtsxx?|h;^XP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z=X0c3&a&KHZ`RrPz3bj^GUi0feSxy@$7?1553(G3{qF56g1MHcT$v15WR2NthS&(u z@_(EeQPW1!xUe@!A`MB6e5GGwk&L~_(`yGuW^XhnwK4XfC?q%^%-w3!N>7&^E*9Phno%;tj`cpe&*_pHHb{{Vm?`FEJ zjvbGjy+L*COltSF6Hbir2+8?eafMr8`(ZDj!8eU&JA8=|xAD1VBe`;AKI3ZZ3nljF zQ+$7jNsO8Sz>}}_Lb@@?1v`B%<(1)Giay1S6##_MDpN^ujBB%~E-go469$v2`<6|@ zJv5yQbQNK|p1Q*EJ@zg-Vkp_en%tF!5qYmgQP*X?vW1De6kxo7UHosdM&^BEe=L-2 zGXvl#BgZ(!ot9|MY%#LMep3+uPnds3pLVbG^Am#s@Yu$rmwi}OwF6=U%vA46Jd1&D z`i!y^a?wsl$>ikQuIAWqQsC(9%?>Z2qGGecNBEP?;-nHZ0pIbZ(To<5tpsqL+VS3G zCD3K!vDj**Tlo6)NJb=?x$@cSUiY0R#N6=WqYpUyR@+lKfRqzH>gkbp zS_pknW$C9Mrq4C4*J?f1N@{(x`$_=$MqybsW?2d}$(T)1SVRS2 zU_bNR;y&^f{3$~oJe;2YS1Wm{o3-d?HASG7n=*qI!33vM6mu~nW z`JCNjnKCW@BPqu(e+*d)Ue%O_#hjMlNMzWy(umn#Uywv%E*HOS{GH(z%PKMcemPf8 zuo0QN^QL2qPm`;(G0S`rp3%VLaHn~t?0&e>pF^=u>v28q6YDxNsmBugWRmk@23=z^ ldees9npiLx!TaQv#Phh?+!eYcOE*6cpiB>$lp485{|nq@6MX;x diff --git a/src/Appwrite/Auth/OAuth2/Bitbucket.php b/src/Appwrite/Auth/OAuth2/Bitbucket.php index 4c089b36c7..36d55fc3ce 100644 --- a/src/Appwrite/Auth/OAuth2/Bitbucket.php +++ b/src/Appwrite/Auth/OAuth2/Bitbucket.php @@ -179,7 +179,7 @@ class Bitbucket extends OAuth2 $emails = \json_decode($emails, true); if (isset($emails['values'])) { foreach ($emails['values'] as $email) { - if ($email['is_primary']) { + if ($email['is_confirmed']) { $this->user['email'] = $email['email']; $this->user['is_confirmed'] = $email['is_confirmed']; break; diff --git a/src/Appwrite/Auth/OAuth2/Vk.php b/src/Appwrite/Auth/OAuth2/Vk.php deleted file mode 100644 index fefd2f7862..0000000000 --- a/src/Appwrite/Auth/OAuth2/Vk.php +++ /dev/null @@ -1,203 +0,0 @@ - $this->appID, - 'redirect_uri' => $this->callback, - 'response_type' => 'code', - 'state' => \json_encode($this->state), - 'v' => $this->version, - 'scope' => \implode(' ', $this->getScopes()) - ]); - } - - /** - * @param string $code - * - * @return array - */ - protected function getTokens(string $code): array - { - if(empty($this->tokens)) { - $headers = ['Content-Type: application/x-www-form-urlencoded;charset=UTF-8']; - $this->tokens = \json_decode($this->request( - 'POST', - 'https://oauth.vk.com/access_token?', - $headers, - \http_build_query([ - 'code' => $code, - 'client_id' => $this->appID, - 'client_secret' => $this->appSecret, - 'redirect_uri' => $this->callback - ]) - ), true); - - $this->user['email'] = $this->tokens['email']; - $this->user['user_id'] = $this->tokens['user_id']; - } - - return $this->tokens; - } - - /** - * @param string $refreshToken - * - * @return array - */ - public function refreshTokens(string $refreshToken):array - { - $headers = ['Content-Type: application/x-www-form-urlencoded;charset=UTF-8']; - $this->tokens = \json_decode($this->request( - 'POST', - 'https://oauth.vk.com/access_token?', - $headers, - \http_build_query([ - 'refresh_token' => $refreshToken, - 'client_id' => $this->appID, - 'client_secret' => $this->appSecret, - 'grant_type' => 'refresh_token' - ]) - ), true); - - if(empty($this->tokens['refresh_token'])) { - $this->tokens['refresh_token'] = $refreshToken; - } - - $this->user['email'] = $this->tokens['email']; - $this->user['user_id'] = $this->tokens['user_id']; - - return $this->tokens; - } - - /** - * @param string $accessToken - * - * @return string - */ - public function getUserID(string $accessToken): string - { - $user = $this->getUser($accessToken); - - if (isset($user['user_id'])) { - return $user['user_id']; - } - - return ''; - } - - /** - * @param string $accessToken - * - * @return string - */ - public function getUserEmail(string $accessToken): string - { - $user = $this->getUser($accessToken); - - if (isset($user['email'])) { - return $user['email']; - } - - return ''; - } - - /** - * Check if the OAuth email is verified - * - * @param $accessToken - * - * @return bool - */ - public function isEmailVerified(string $accessToken): bool - { - return false; - } - - /** - * @param string $accessToken - * - * @return string - */ - public function getUserName(string $accessToken): string - { - $user = $this->getUser($accessToken); - - if (isset($user['name'])) { - return $user['name']; - } - - return ''; - } - - /** - * @param string $accessToken - * - * @return array - */ - protected function getUser(string $accessToken): array - { - if (empty($this->user['name'])) { - $user = $this->request( - 'GET', - 'https://api.vk.com/method/users.get?'. \http_build_query([ - 'v' => $this->version, - 'fields' => 'id,name,email,first_name,last_name', - 'access_token' => $accessToken - ]) - ); - - $user = \json_decode($user, true); - $this->user['name'] = $user['response'][0]['first_name'] ." ".$user['response'][0]['last_name']; - } - return $this->user; - } -} diff --git a/src/Appwrite/Auth/OAuth2/Yammer.php b/src/Appwrite/Auth/OAuth2/Yammer.php index a50975c82e..9ec9b56eea 100644 --- a/src/Appwrite/Auth/OAuth2/Yammer.php +++ b/src/Appwrite/Auth/OAuth2/Yammer.php @@ -133,7 +133,7 @@ class Yammer extends OAuth2 /** * Check if the OAuth email is verified * - * If present, the email is verified. + * If present, the email is verified. This was verfied through a manual Yammer sign up process * * @param $accessToken *