@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add Google support to new registration flow

Summary: Ref T1536. Adds Google support.

Test Plan: Registered and logged in with Google.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1536

Differential Revision: https://secure.phabricator.com/D6167

+49
+2
src/__phutil_library_map__.php
··· 821 821 'PhabricatorAuthProviderOAuthDisqus' => 'applications/auth/provider/PhabricatorAuthProviderOAuthDisqus.php', 822 822 'PhabricatorAuthProviderOAuthFacebook' => 'applications/auth/provider/PhabricatorAuthProviderOAuthFacebook.php', 823 823 'PhabricatorAuthProviderOAuthGitHub' => 'applications/auth/provider/PhabricatorAuthProviderOAuthGitHub.php', 824 + 'PhabricatorAuthProviderOAuthGoogle' => 'applications/auth/provider/PhabricatorAuthProviderOAuthGoogle.php', 824 825 'PhabricatorAuthProviderPassword' => 'applications/auth/provider/PhabricatorAuthProviderPassword.php', 825 826 'PhabricatorAuthRegisterController' => 'applications/auth/controller/PhabricatorAuthRegisterController.php', 826 827 'PhabricatorAuthStartController' => 'applications/auth/controller/PhabricatorAuthStartController.php', ··· 2683 2684 'PhabricatorAuthProviderOAuthDisqus' => 'PhabricatorAuthProviderOAuth', 2684 2685 'PhabricatorAuthProviderOAuthFacebook' => 'PhabricatorAuthProviderOAuth', 2685 2686 'PhabricatorAuthProviderOAuthGitHub' => 'PhabricatorAuthProviderOAuth', 2687 + 'PhabricatorAuthProviderOAuthGoogle' => 'PhabricatorAuthProviderOAuth', 2686 2688 'PhabricatorAuthProviderPassword' => 'PhabricatorAuthProvider', 2687 2689 'PhabricatorAuthRegisterController' => 'PhabricatorAuthController', 2688 2690 'PhabricatorAuthStartController' => 'PhabricatorAuthController',
+47
src/applications/auth/provider/PhabricatorAuthProviderOAuthGoogle.php
··· 1 + <?php 2 + 3 + final class PhabricatorAuthProviderOAuthGoogle 4 + extends PhabricatorAuthProviderOAuth { 5 + 6 + public function getProviderName() { 7 + return pht('Google'); 8 + } 9 + 10 + protected function newOAuthAdapter() { 11 + return new PhutilAuthAdapterOAuthGoogle(); 12 + } 13 + 14 + public function isEnabled() { 15 + return parent::isEnabled() && 16 + PhabricatorEnv::getEnvConfig('google.auth-enabled'); 17 + } 18 + 19 + protected function getOAuthClientID() { 20 + return PhabricatorEnv::getEnvConfig('google.application-id'); 21 + } 22 + 23 + protected function getOAuthClientSecret() { 24 + $secret = PhabricatorEnv::getEnvConfig('google.application-secret'); 25 + if ($secret) { 26 + return new PhutilOpaqueEnvelope($secret); 27 + } 28 + return null; 29 + } 30 + 31 + public function shouldAllowLogin() { 32 + return true; 33 + } 34 + 35 + public function shouldAllowRegistration() { 36 + return PhabricatorEnv::getEnvConfig('google.registration-enabled'); 37 + } 38 + 39 + public function shouldAllowAccountLink() { 40 + return true; 41 + } 42 + 43 + public function shouldAllowAccountUnlink() { 44 + return !PhabricatorEnv::getEnvConfig('google.auth-permanent'); 45 + } 46 + 47 + }