1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Add Slack authentication adapter

Summary: For phabricator. Adds a Slack auth adapater and icon.

Test Plan:
Create a new Slack Application for login, generate id and secret. Activate login and registration for Slack. Create a new account with Slack credentials. Log out. Log in with Slack credentials. Set my avatar with Slack. Slack. Slack.

{F1802649}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D16496
This commit is contained in:
Chad 2016-09-06 15:50:37 +00:00 committed by chad
parent 7e365fd3f1
commit defee93851
9 changed files with 60 additions and 13 deletions

View file

@ -7,7 +7,7 @@
*/
return array(
'names' => array(
'core.pkg.css' => 'aee99781',
'core.pkg.css' => 'ee3f9253',
'core.pkg.js' => '1d376fa9',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '3fb7f532',
@ -163,7 +163,7 @@ return array(
'rsrc/css/phui/workboards/phui-workboard.css' => 'bda3ef58',
'rsrc/css/phui/workboards/phui-workcard.css' => '0c62d7c5',
'rsrc/css/phui/workboards/phui-workpanel.css' => '92197373',
'rsrc/css/sprite-login.css' => '60e8560e',
'rsrc/css/sprite-login.css' => '6dbbbd97',
'rsrc/css/sprite-tokens.css' => '9cdfd599',
'rsrc/css/syntax/syntax-default.css' => '9923583c',
'rsrc/externals/d3/d3.min.js' => 'a11a5ff2',
@ -342,8 +342,8 @@ return array(
'rsrc/image/phrequent_active.png' => 'a466a8ed',
'rsrc/image/phrequent_inactive.png' => 'bfc15a69',
'rsrc/image/resize.png' => 'fd476de4',
'rsrc/image/sprite-login-X2.png' => 'e3991e37',
'rsrc/image/sprite-login.png' => '03d5af29',
'rsrc/image/sprite-login-X2.png' => '4abee916',
'rsrc/image/sprite-login.png' => '2b9663fd',
'rsrc/image/sprite-tokens-X2.png' => '804a5232',
'rsrc/image/sprite-tokens.png' => 'b41d03da',
'rsrc/image/texture/card-gradient.png' => '815f26e8',
@ -890,7 +890,7 @@ return array(
'releeph-request-differential-create-dialog' => '8d8b92cd',
'releeph-request-typeahead-css' => '667a48ae',
'setup-issue-css' => 'f794cfc3',
'sprite-login-css' => '60e8560e',
'sprite-login-css' => '6dbbbd97',
'sprite-tokens-css' => '9cdfd599',
'syntax-default-css' => '9923583c',
'syntax-highlighting-css' => '769d3498',

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

@ -91,6 +91,11 @@
"rule": ".login-Phabricator",
"hash": "d0f830803593bbcc025d7d5a29ee3ecd"
},
"login-Slack": {
"name": "login-Slack",
"rule": ".login-Slack",
"hash": "fe0df2df040032b949aa05948b6bd986"
},
"login-Stripe": {
"name": "login-Stripe",
"rule": ".login-Stripe",

View file

@ -3587,6 +3587,7 @@ phutil_register_library_map(array(
'PhabricatorShowFiletreeSetting' => 'applications/settings/setting/PhabricatorShowFiletreeSetting.php',
'PhabricatorSimpleEditType' => 'applications/transactions/edittype/PhabricatorSimpleEditType.php',
'PhabricatorSite' => 'aphront/site/PhabricatorSite.php',
'PhabricatorSlackAuthProvider' => 'applications/auth/provider/PhabricatorSlackAuthProvider.php',
'PhabricatorSlowvoteApplication' => 'applications/slowvote/application/PhabricatorSlowvoteApplication.php',
'PhabricatorSlowvoteChoice' => 'applications/slowvote/storage/PhabricatorSlowvoteChoice.php',
'PhabricatorSlowvoteCloseController' => 'applications/slowvote/controller/PhabricatorSlowvoteCloseController.php',
@ -8590,6 +8591,7 @@ phutil_register_library_map(array(
'PhabricatorShowFiletreeSetting' => 'PhabricatorSelectSetting',
'PhabricatorSimpleEditType' => 'PhabricatorEditType',
'PhabricatorSite' => 'AphrontSite',
'PhabricatorSlackAuthProvider' => 'PhabricatorOAuth2AuthProvider',
'PhabricatorSlowvoteApplication' => 'PhabricatorApplication',
'PhabricatorSlowvoteChoice' => 'PhabricatorSlowvoteDAO',
'PhabricatorSlowvoteCloseController' => 'PhabricatorSlowvoteController',

View file

@ -0,0 +1,36 @@
<?php
final class PhabricatorSlackAuthProvider
extends PhabricatorOAuth2AuthProvider {
public function getProviderName() {
return pht('Slack');
}
protected function getProviderConfigurationHelp() {
$login_uri = PhabricatorEnv::getURI($this->getLoginURI());
return pht(
"To configure Slack OAuth, create a new application here:".
"\n\n".
"https://api.slack.com/docs/sign-in-with-slack#create_slack_app".
"\n\n".
"When creating your application, use these settings:".
"\n\n".
" - **Redirect URI:** Set this to: `%s`".
"\n\n".
"After completing configuration, copy the **Client ID** and ".
"**Client Secret** to the fields above. (You may need to generate the ".
"client secret by clicking 'New Secret' first.)",
$login_uri);
}
protected function newOAuthAdapter() {
return new PhutilSlackAuthAdapter();
}
protected function getLoginIcon() {
return 'Slack';
}
}

View file

@ -14,7 +14,7 @@ only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (min-resolution: 1.5dppx) {
.sprite-login {
background-image: url(/rsrc/image/sprite-login-X2.png);
background-size: 145px 145px;
background-size: 145px 174px;
}
}
@ -91,30 +91,34 @@ only screen and (min-resolution: 1.5dppx) {
background-position: -58px -87px;
}
.login-Stripe {
.login-Slack {
background-position: -87px -87px;
}
.login-TestPayment {
.login-Stripe {
background-position: -116px -87px;
}
.login-TwitchTV {
.login-TestPayment {
background-position: 0px -116px;
}
.login-Twitter {
.login-TwitchTV {
background-position: -29px -116px;
}
.login-WePay {
.login-Twitter {
background-position: -58px -116px;
}
.login-WordPressCOM {
.login-WePay {
background-position: -87px -116px;
}
.login-Yahoo {
.login-WordPressCOM {
background-position: -116px -116px;
}
.login-Yahoo {
background-position: 0px -145px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 20 KiB