@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 GitHub auth to new flows

Summary: Ref T1536. Support for GitHub on new flows.

Test Plan: Registered and logged in with GitHub.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1536

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

+50 -5
+2
src/__phutil_library_map__.php
··· 820 820 'PhabricatorAuthProviderOAuth' => 'applications/auth/provider/PhabricatorAuthProviderOAuth.php', 821 821 'PhabricatorAuthProviderOAuthDisqus' => 'applications/auth/provider/PhabricatorAuthProviderOAuthDisqus.php', 822 822 'PhabricatorAuthProviderOAuthFacebook' => 'applications/auth/provider/PhabricatorAuthProviderOAuthFacebook.php', 823 + 'PhabricatorAuthProviderOAuthGitHub' => 'applications/auth/provider/PhabricatorAuthProviderOAuthGitHub.php', 823 824 'PhabricatorAuthProviderPassword' => 'applications/auth/provider/PhabricatorAuthProviderPassword.php', 824 825 'PhabricatorAuthRegisterController' => 'applications/auth/controller/PhabricatorAuthRegisterController.php', 825 826 'PhabricatorAuthStartController' => 'applications/auth/controller/PhabricatorAuthStartController.php', ··· 2681 2682 'PhabricatorAuthProviderOAuth' => 'PhabricatorAuthProvider', 2682 2683 'PhabricatorAuthProviderOAuthDisqus' => 'PhabricatorAuthProviderOAuth', 2683 2684 'PhabricatorAuthProviderOAuthFacebook' => 'PhabricatorAuthProviderOAuth', 2685 + 'PhabricatorAuthProviderOAuthGitHub' => 'PhabricatorAuthProviderOAuth', 2684 2686 'PhabricatorAuthProviderPassword' => 'PhabricatorAuthProvider', 2685 2687 'PhabricatorAuthRegisterController' => 'PhabricatorAuthController', 2686 2688 'PhabricatorAuthStartController' => 'PhabricatorAuthController',
+1 -5
src/applications/auth/provider/PhabricatorAuthProviderOAuthFacebook.php
··· 12 12 } 13 13 14 14 public function isEnabled() { 15 - 16 - // TODO: Remove this once we switch to the new auth mechanism. 17 - 18 - return false && 19 - parent::isEnabled() && 15 + return parent::isEnabled() && 20 16 PhabricatorEnv::getEnvConfig('facebook.auth-enabled'); 21 17 } 22 18
+47
src/applications/auth/provider/PhabricatorAuthProviderOAuthGitHub.php
··· 1 + <?php 2 + 3 + final class PhabricatorAuthProviderOAuthGitHub 4 + extends PhabricatorAuthProviderOAuth { 5 + 6 + public function getProviderName() { 7 + return pht('GitHub'); 8 + } 9 + 10 + protected function newOAuthAdapter() { 11 + return new PhutilAuthAdapterOAuthGitHub(); 12 + } 13 + 14 + public function isEnabled() { 15 + return parent::isEnabled() && 16 + PhabricatorEnv::getEnvConfig('github.auth-enabled'); 17 + } 18 + 19 + protected function getOAuthClientID() { 20 + return PhabricatorEnv::getEnvConfig('github.application-id'); 21 + } 22 + 23 + protected function getOAuthClientSecret() { 24 + $secret = PhabricatorEnv::getEnvConfig('github.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('github.registration-enabled'); 37 + } 38 + 39 + public function shouldAllowAccountLink() { 40 + return true; 41 + } 42 + 43 + public function shouldAllowAccountUnlink() { 44 + return !PhabricatorEnv::getEnvConfig('github.auth-permanent'); 45 + } 46 + 47 + }