Skip to content

Commit defee93

Browse files
Chadchad
Chad
authored and
chad
committedSep 6, 2016
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
1 parent 7e365fd commit defee93

File tree

9 files changed

+60
-13
lines changed

9 files changed

+60
-13
lines changed
 

‎resources/celerity/map.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
return array(
99
'names' => array(
10-
'core.pkg.css' => 'aee99781',
10+
'core.pkg.css' => 'ee3f9253',
1111
'core.pkg.js' => '1d376fa9',
1212
'darkconsole.pkg.js' => 'e7393ebb',
1313
'differential.pkg.css' => '3fb7f532',
@@ -163,7 +163,7 @@
163163
'rsrc/css/phui/workboards/phui-workboard.css' => 'bda3ef58',
164164
'rsrc/css/phui/workboards/phui-workcard.css' => '0c62d7c5',
165165
'rsrc/css/phui/workboards/phui-workpanel.css' => '92197373',
166-
'rsrc/css/sprite-login.css' => '60e8560e',
166+
'rsrc/css/sprite-login.css' => '6dbbbd97',
167167
'rsrc/css/sprite-tokens.css' => '9cdfd599',
168168
'rsrc/css/syntax/syntax-default.css' => '9923583c',
169169
'rsrc/externals/d3/d3.min.js' => 'a11a5ff2',
@@ -342,8 +342,8 @@
342342
'rsrc/image/phrequent_active.png' => 'a466a8ed',
343343
'rsrc/image/phrequent_inactive.png' => 'bfc15a69',
344344
'rsrc/image/resize.png' => 'fd476de4',
345-
'rsrc/image/sprite-login-X2.png' => 'e3991e37',
346-
'rsrc/image/sprite-login.png' => '03d5af29',
345+
'rsrc/image/sprite-login-X2.png' => '4abee916',
346+
'rsrc/image/sprite-login.png' => '2b9663fd',
347347
'rsrc/image/sprite-tokens-X2.png' => '804a5232',
348348
'rsrc/image/sprite-tokens.png' => 'b41d03da',
349349
'rsrc/image/texture/card-gradient.png' => '815f26e8',
@@ -890,7 +890,7 @@
890890
'releeph-request-differential-create-dialog' => '8d8b92cd',
891891
'releeph-request-typeahead-css' => '667a48ae',
892892
'setup-issue-css' => 'f794cfc3',
893-
'sprite-login-css' => '60e8560e',
893+
'sprite-login-css' => '6dbbbd97',
894894
'sprite-tokens-css' => '9cdfd599',
895895
'syntax-default-css' => '9923583c',
896896
'syntax-highlighting-css' => '769d3498',

‎resources/sprite/login_1x/Slack.png

1.62 KB
Loading

‎resources/sprite/login_2x/Slack.png

3.94 KB
Loading

‎resources/sprite/manifest/login.json

+5
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@
9191
"rule": ".login-Phabricator",
9292
"hash": "d0f830803593bbcc025d7d5a29ee3ecd"
9393
},
94+
"login-Slack": {
95+
"name": "login-Slack",
96+
"rule": ".login-Slack",
97+
"hash": "fe0df2df040032b949aa05948b6bd986"
98+
},
9499
"login-Stripe": {
95100
"name": "login-Stripe",
96101
"rule": ".login-Stripe",

‎src/__phutil_library_map__.php

+2
Original file line numberDiff line numberDiff line change
@@ -3587,6 +3587,7 @@
35873587
'PhabricatorShowFiletreeSetting' => 'applications/settings/setting/PhabricatorShowFiletreeSetting.php',
35883588
'PhabricatorSimpleEditType' => 'applications/transactions/edittype/PhabricatorSimpleEditType.php',
35893589
'PhabricatorSite' => 'aphront/site/PhabricatorSite.php',
3590+
'PhabricatorSlackAuthProvider' => 'applications/auth/provider/PhabricatorSlackAuthProvider.php',
35903591
'PhabricatorSlowvoteApplication' => 'applications/slowvote/application/PhabricatorSlowvoteApplication.php',
35913592
'PhabricatorSlowvoteChoice' => 'applications/slowvote/storage/PhabricatorSlowvoteChoice.php',
35923593
'PhabricatorSlowvoteCloseController' => 'applications/slowvote/controller/PhabricatorSlowvoteCloseController.php',
@@ -8590,6 +8591,7 @@
85908591
'PhabricatorShowFiletreeSetting' => 'PhabricatorSelectSetting',
85918592
'PhabricatorSimpleEditType' => 'PhabricatorEditType',
85928593
'PhabricatorSite' => 'AphrontSite',
8594+
'PhabricatorSlackAuthProvider' => 'PhabricatorOAuth2AuthProvider',
85938595
'PhabricatorSlowvoteApplication' => 'PhabricatorApplication',
85948596
'PhabricatorSlowvoteChoice' => 'PhabricatorSlowvoteDAO',
85958597
'PhabricatorSlowvoteCloseController' => 'PhabricatorSlowvoteController',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
final class PhabricatorSlackAuthProvider
4+
extends PhabricatorOAuth2AuthProvider {
5+
6+
public function getProviderName() {
7+
return pht('Slack');
8+
}
9+
10+
protected function getProviderConfigurationHelp() {
11+
$login_uri = PhabricatorEnv::getURI($this->getLoginURI());
12+
13+
return pht(
14+
"To configure Slack OAuth, create a new application here:".
15+
"\n\n".
16+
"https://api.slack.com/docs/sign-in-with-slack#create_slack_app".
17+
"\n\n".
18+
"When creating your application, use these settings:".
19+
"\n\n".
20+
" - **Redirect URI:** Set this to: `%s`".
21+
"\n\n".
22+
"After completing configuration, copy the **Client ID** and ".
23+
"**Client Secret** to the fields above. (You may need to generate the ".
24+
"client secret by clicking 'New Secret' first.)",
25+
$login_uri);
26+
}
27+
28+
protected function newOAuthAdapter() {
29+
return new PhutilSlackAuthAdapter();
30+
}
31+
32+
protected function getLoginIcon() {
33+
return 'Slack';
34+
}
35+
36+
}

‎webroot/rsrc/css/sprite-login.css

+12-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ only screen and (-webkit-min-device-pixel-ratio: 1.5),
1414
only screen and (min-resolution: 1.5dppx) {
1515
.sprite-login {
1616
background-image: url(/rsrc/image/sprite-login-X2.png);
17-
background-size: 145px 145px;
17+
background-size: 145px 174px;
1818
}
1919
}
2020

@@ -91,30 +91,34 @@ only screen and (min-resolution: 1.5dppx) {
9191
background-position: -58px -87px;
9292
}
9393

94-
.login-Stripe {
94+
.login-Slack {
9595
background-position: -87px -87px;
9696
}
9797

98-
.login-TestPayment {
98+
.login-Stripe {
9999
background-position: -116px -87px;
100100
}
101101

102-
.login-TwitchTV {
102+
.login-TestPayment {
103103
background-position: 0px -116px;
104104
}
105105

106-
.login-Twitter {
106+
.login-TwitchTV {
107107
background-position: -29px -116px;
108108
}
109109

110-
.login-WePay {
110+
.login-Twitter {
111111
background-position: -58px -116px;
112112
}
113113

114-
.login-WordPressCOM {
114+
.login-WePay {
115115
background-position: -87px -116px;
116116
}
117117

118-
.login-Yahoo {
118+
.login-WordPressCOM {
119119
background-position: -116px -116px;
120120
}
121+
122+
.login-Yahoo {
123+
background-position: 0px -145px;
124+
}
10.7 KB
Loading

‎webroot/rsrc/image/sprite-login.png

4.27 KB
Loading

0 commit comments

Comments
 (0)
Failed to load comments.