@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.

WordPress.com OAuth2 plugin

Summary:
This plugin provides an OAuth authentication provider to authenticate users using WordPress.com Connect.

This diff corresponds to github pull request https://github.com/facebook/phabricator/pull/593/ and had its libphutil counterpart reviewed in D9004.

Test Plan: Configured WordPress.com as an authentication provider, saw it show up on the login screen, registered a new account, got expected defaults for my username/name/email/profile picture.

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

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

authored by

Ashish SHUKLA and committed by
epriestley
0da22abd 38739755

+68 -19
resources/sprite/login_1x/WordPressCOM.png

This is a binary file and will not be displayed.

resources/sprite/login_2x/WordPressCOM.png

This is a binary file and will not be displayed.

+23 -18
resources/sprite/manifest/login.json
··· 1 1 { 2 2 "version" : 1, 3 3 "sprites" : { 4 - "login-Amazon" : { 4 + "login-Amazon" : { 5 5 "name" : "login-Amazon", 6 6 "rule" : ".login-Amazon", 7 7 "hash" : "5961e41c525ef46c88558616fcf23272" 8 8 }, 9 - "login-Asana" : { 9 + "login-Asana" : { 10 10 "name" : "login-Asana", 11 11 "rule" : ".login-Asana", 12 12 "hash" : "30df492eab339fa64c9ae9b21bb46a18" 13 13 }, 14 - "login-Disqus" : { 14 + "login-Disqus" : { 15 15 "name" : "login-Disqus", 16 16 "rule" : ".login-Disqus", 17 17 "hash" : "5f46ac50a5d9d13245971c298f49e13b" 18 18 }, 19 - "login-Dropbox" : { 19 + "login-Dropbox" : { 20 20 "name" : "login-Dropbox", 21 21 "rule" : ".login-Dropbox", 22 22 "hash" : "572ab36301762414365b68c0bc185ac5" 23 23 }, 24 - "login-Facebook" : { 24 + "login-Facebook" : { 25 25 "name" : "login-Facebook", 26 26 "rule" : ".login-Facebook", 27 27 "hash" : "2b1511f5b4d12076dd9086d1bb187b28" 28 28 }, 29 - "login-Generic" : { 29 + "login-Generic" : { 30 30 "name" : "login-Generic", 31 31 "rule" : ".login-Generic", 32 32 "hash" : "60d75c38668ffd6eea91a40e66186601" 33 33 }, 34 - "login-Github" : { 34 + "login-Github" : { 35 35 "name" : "login-Github", 36 36 "rule" : ".login-Github", 37 37 "hash" : "633696beb8c1eaac642ce4955be917d8" 38 38 }, 39 - "login-Google" : { 39 + "login-Google" : { 40 40 "name" : "login-Google", 41 41 "rule" : ".login-Google", 42 42 "hash" : "b7d3962a31df1e6c13e0a3c97c08f11d" 43 43 }, 44 - "login-HTTP" : { 44 + "login-HTTP" : { 45 45 "name" : "login-HTTP", 46 46 "rule" : ".login-HTTP", 47 47 "hash" : "6fcf0f666c0f6f1e1cd8f397b41ed176" 48 48 }, 49 - "login-Jira" : { 49 + "login-Jira" : { 50 50 "name" : "login-Jira", 51 51 "rule" : ".login-Jira", 52 52 "hash" : "0ddadec77a95c1efc398886252ebeda9" 53 53 }, 54 - "login-LDAP" : { 54 + "login-LDAP" : { 55 55 "name" : "login-LDAP", 56 56 "rule" : ".login-LDAP", 57 57 "hash" : "5b4e01ddf35cd40c8f061c90abc89b6c" 58 58 }, 59 - "login-Linkedin" : { 59 + "login-Linkedin" : { 60 60 "name" : "login-Linkedin", 61 61 "rule" : ".login-Linkedin", 62 62 "hash" : "0dd89825046fa4fd0fe402aa2cd55fd1" 63 63 }, 64 - "login-Openid" : { 64 + "login-Openid" : { 65 65 "name" : "login-Openid", 66 66 "rule" : ".login-Openid", 67 67 "hash" : "9267ffbb8d4e6dee409c4d8fa2d50c0a" 68 68 }, 69 - "login-Persona" : { 69 + "login-Persona" : { 70 70 "name" : "login-Persona", 71 71 "rule" : ".login-Persona", 72 72 "hash" : "949faf7bf5ed377c06aa480da1f42b74" 73 73 }, 74 - "login-Phabricator" : { 74 + "login-Phabricator" : { 75 75 "name" : "login-Phabricator", 76 76 "rule" : ".login-Phabricator", 77 77 "hash" : "fad258eb347a1ccf5800b0ee2d8e6e49" 78 78 }, 79 - "login-TwitchTV" : { 79 + "login-TwitchTV" : { 80 80 "name" : "login-TwitchTV", 81 81 "rule" : ".login-TwitchTV", 82 82 "hash" : "dbaa3f5e58fceb86598b2951fc5f9508" 83 83 }, 84 - "login-Twitter" : { 84 + "login-Twitter" : { 85 85 "name" : "login-Twitter", 86 86 "rule" : ".login-Twitter", 87 87 "hash" : "0b64983507a720b365474b778a966bab" 88 88 }, 89 - "login-Yahoo" : { 89 + "login-WordPressCOM" : { 90 + "name" : "login-WordPressCOM", 91 + "rule" : ".login-WordPressCOM", 92 + "hash" : "c22a183bfb1e46deeab864223ec48db9" 93 + }, 94 + "login-Yahoo" : { 90 95 "name" : "login-Yahoo", 91 96 "rule" : ".login-Yahoo", 92 97 "hash" : "1cc6fceee294045fe6d1c1d3aa31d2c1"
+2
src/__phutil_library_map__.php
··· 1254 1254 'PhabricatorAuthProviderOAuthGitHub' => 'applications/auth/provider/PhabricatorAuthProviderOAuthGitHub.php', 1255 1255 'PhabricatorAuthProviderOAuthGoogle' => 'applications/auth/provider/PhabricatorAuthProviderOAuthGoogle.php', 1256 1256 'PhabricatorAuthProviderOAuthTwitch' => 'applications/auth/provider/PhabricatorAuthProviderOAuthTwitch.php', 1257 + 'PhabricatorAuthProviderOAuthWordPress' => 'applications/auth/provider/PhabricatorAuthProviderOAuthWordPress.php', 1257 1258 'PhabricatorAuthProviderPassword' => 'applications/auth/provider/PhabricatorAuthProviderPassword.php', 1258 1259 'PhabricatorAuthProviderPersona' => 'applications/auth/provider/PhabricatorAuthProviderPersona.php', 1259 1260 'PhabricatorAuthRegisterController' => 'applications/auth/controller/PhabricatorAuthRegisterController.php', ··· 4041 4042 'PhabricatorAuthProviderOAuthGitHub' => 'PhabricatorAuthProviderOAuth2', 4042 4043 'PhabricatorAuthProviderOAuthGoogle' => 'PhabricatorAuthProviderOAuth2', 4043 4044 'PhabricatorAuthProviderOAuthTwitch' => 'PhabricatorAuthProviderOAuth2', 4045 + 'PhabricatorAuthProviderOAuthWordPress' => 'PhabricatorAuthProviderOAuth2', 4044 4046 'PhabricatorAuthProviderPassword' => 'PhabricatorAuthProvider', 4045 4047 'PhabricatorAuthProviderPersona' => 'PhabricatorAuthProvider', 4046 4048 'PhabricatorAuthRegisterController' => 'PhabricatorAuthController',
+38
src/applications/auth/provider/PhabricatorAuthProviderOAuthWordPress.php
··· 1 + <?php 2 + 3 + final class PhabricatorAuthProviderOAuthWordPress 4 + extends PhabricatorAuthProviderOAuth2 { 5 + 6 + public function getProviderName() { 7 + return pht('WordPress.com'); 8 + } 9 + 10 + protected function getProviderConfigurationHelp() { 11 + $uri = PhabricatorEnv::getProductionURI('/'); 12 + $callback_uri = PhabricatorEnv::getURI($this->getLoginURI()); 13 + 14 + return pht( 15 + "To configure WordPress.com OAuth, create a new WordPress.com ". 16 + "Application here:\n\n". 17 + "https://developer.wordpress.com/apps/new/.". 18 + "\n\n". 19 + "You should use these settings in your application:". 20 + "\n\n". 21 + " - **URL:** Set this to your full domain with protocol. For this ". 22 + " Phabricator install, the correct value is: `%s`\n". 23 + " - **Redirect URL**: Set this to: `%s`\n". 24 + "\n\n". 25 + "Once you've created an application, copy the **Client ID** and ". 26 + "**Client Secret** into the fields above.", 27 + $uri, 28 + $callback_uri); 29 + } 30 + 31 + protected function newOAuthAdapter() { 32 + return new PhutilAuthAdapterOAuthWordPress(); 33 + } 34 + 35 + protected function getLoginIcon() { 36 + return 'WordPressCOM'; 37 + } 38 + }
+5 -1
webroot/rsrc/css/sprite-login.css
··· 86 86 background-position: 0px -140px; 87 87 } 88 88 89 - .login-Yahoo { 89 + .login-WordPressCOM { 90 90 background-position: -35px -140px; 91 91 } 92 + 93 + .login-Yahoo { 94 + background-position: -70px -140px; 95 + }
webroot/rsrc/image/sprite-login-X2.png

This is a binary file and will not be displayed.

webroot/rsrc/image/sprite-login.png

This is a binary file and will not be displayed.