18 files changed +167
-158
lines changed Original file line number Diff line number Diff line change 553
553
554
554
// -- Auth ------------------------------------------------------------------ //
555
555
556
- // Can users login with a username/password, or by following the link from
557
- // a password reset email? You can disable this and configure one or more
558
- // OAuth providers instead.
559
- 'auth.password-auth-enabled ' => true ,
560
-
561
556
// Maximum number of simultaneous web sessions each user is permitted to have.
562
557
// Setting this to "1" will prevent a user from logging in on more than one
563
558
// browser at the same time.
1032
1027
'aphront.default-application-configuration-class ' =>
1033
1028
'AphrontDefaultApplicationConfiguration ' ,
1034
1029
1035
- 'controller.oauth-registration ' =>
1036
- 'PhabricatorOAuthDefaultRegistrationController ' ,
1037
-
1038
-
1039
1030
// Directory that phd (the Phabricator daemon control script) should use to
1040
1031
// track running daemons.
1041
1032
'phd.pid-directory ' => '/var/tmp/phd/pid ' ,
Original file line number Diff line number Diff line change @@ -14,6 +14,18 @@ public function getIconName() {
14
14
return 'authentication ' ;
15
15
}
16
16
17
+ public function getHelpURI () {
18
+ // NOTE: Although reasonable help exists for this in "Configuring Accounts
19
+ // and Registration", specifying a help URI here means we get the menu
20
+ // item in all the login/link interfaces, which is confusing and not
21
+ // helpful.
22
+
23
+ // TODO: Special case this, or split the auth and auth administration
24
+ // applications?
25
+
26
+ return null ;
27
+ }
28
+
17
29
public function buildMainMenuItems (
18
30
PhabricatorUser $ user ,
19
31
PhabricatorController $ controller = null ) {
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public function shouldRequireLogin() {
10
10
public function processRequest () {
11
11
$ request = $ this ->getRequest ();
12
12
13
- if (!PhabricatorEnv:: getEnvConfig ( ' auth.password-auth-enabled ' )) {
13
+ if (!PhabricatorAuthProviderPassword:: getPasswordProvider ( )) {
14
14
return new Aphront400Response ();
15
15
}
16
16
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ public function processRequest() {
74
74
unset($ unguarded );
75
75
76
76
$ next = '/ ' ;
77
- if (!PhabricatorEnv:: getEnvConfig ( ' auth.password-auth-enabled ' )) {
77
+ if (!PhabricatorAuthProviderPassword:: getPasswordProvider ( )) {
78
78
$ next = '/settings/panel/external/ ' ;
79
79
} else if (PhabricatorEnv::getEnvConfig ('account.editable ' )) {
80
80
$ next = (string )id (new PhutilURI ('/settings/panel/password/ ' ))
Original file line number Diff line number Diff line change @@ -224,6 +224,12 @@ public function processRequest() {
224
224
->addCancelButton ($ cancel_uri )
225
225
->setValue ($ button ));
226
226
227
+ $ help = $ provider ->getConfigurationHelp ();
228
+ if ($ help ) {
229
+ $ form ->appendChild (id (new PHUIFormDividerControl ()));
230
+ $ form ->appendRemarkupInstructions ($ help );
231
+ }
232
+
227
233
$ crumbs = $ this ->buildApplicationCrumbs ();
228
234
$ crumbs ->addCrumb (
229
235
id (new PhabricatorCrumbView ())
Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ public function getProviderConfig() {
21
21
return $ this ->providerConfig ;
22
22
}
23
23
24
+ public function getConfigurationHelp () {
25
+ return null ;
26
+ }
27
+
24
28
public function getDefaultProviderConfig () {
25
29
return id (new PhabricatorAuthProviderConfig ())
26
30
->setProviderClass (get_class ($ this ))
Original file line number Diff line number Diff line change @@ -7,6 +7,24 @@ public function getProviderName() {
7
7
return pht ('Disqus ' );
8
8
}
9
9
10
+ public function getConfigurationHelp () {
11
+ $ login_uri = $ this ->getLoginURI ();
12
+
13
+ return pht (
14
+ "To configure Disqus OAuth, create a new application here: " .
15
+ "\n\n" .
16
+ "http://disqus.com/api/applications/ " .
17
+ "\n\n" .
18
+ "Create an application, then adjust these settings: " .
19
+ "\n\n" .
20
+ " - **Callback URL:** Set this to `%s` " .
21
+ "\n\n" .
22
+ "After creating an application, copy the **Public Key** and " .
23
+ "**Secret Key** to the fields above (the **Public Key** goes in " .
24
+ "**OAuth App ID**). " ,
25
+ $ login_uri );
26
+ }
27
+
10
28
protected function newOAuthAdapter () {
11
29
return new PhutilAuthAdapterOAuthDisqus ();
12
30
}
Original file line number Diff line number Diff line change @@ -9,6 +9,25 @@ public function getProviderName() {
9
9
return pht ('Facebook ' );
10
10
}
11
11
12
+ public function getConfigurationHelp () {
13
+ $ uri = new PhutilURI (PhabricatorEnv::getProductionURI ('/ ' ));
14
+ return pht (
15
+ 'To configure Facebook OAuth, create a new Facebook Application here: ' .
16
+ "\n\n" .
17
+ 'https://developers.facebook.com/apps ' .
18
+ "\n\n" .
19
+ 'You should use these settings in your application: ' .
20
+ "\n\n" .
21
+ " - **Site URL**: Set this to your full domain with protocol. For " .
22
+ " this Phabricator install, the correct value is: `%s` \n" .
23
+ " - **Site Domain**: Set this to the full domain without a protocol. " .
24
+ " For this Phabricator install, the correct value is: `%s` \n\n" .
25
+ "After creating your new application, copy the **App ID** and " .
26
+ "**App Secret** to the fields above. " ,
27
+ (string )$ uri ,
28
+ $ uri ->getDomain ());
29
+ }
30
+
12
31
public function getDefaultProviderConfig () {
13
32
return parent ::getDefaultProviderConfig ()
14
33
->setProperty (self ::KEY_REQUIRE_SECURE , 1 );
Original file line number Diff line number Diff line change @@ -7,6 +7,27 @@ public function getProviderName() {
7
7
return pht ('GitHub ' );
8
8
}
9
9
10
+ public function getConfigurationHelp () {
11
+ $ uri = PhabricatorEnv::getProductionURI ('/ ' );
12
+ $ callback_uri = $ this ->getLoginURI ();
13
+
14
+ return pht (
15
+ "To configure GitHub OAuth, create a new GitHub Application here: " .
16
+ "\n\n" .
17
+ "https://github.com/settings/applications/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
+ " - **Callback 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
+
10
31
protected function newOAuthAdapter () {
11
32
return new PhutilAuthAdapterOAuthGitHub ();
12
33
}
Original file line number Diff line number Diff line change @@ -7,6 +7,27 @@ public function getProviderName() {
7
7
return pht ('Google ' );
8
8
}
9
9
10
+ public function getConfigurationHelp () {
11
+ $ login_uri = $ this ->getLoginURI ();
12
+
13
+ return pht (
14
+ "To configure Google OAuth, create a new 'API Project' here: " .
15
+ "\n\n" .
16
+ "https://code.google.com/apis/console/ " .
17
+ "\n\n" .
18
+ "You don't need to enable any Services, just go to **API Access**, " .
19
+ "click **Create an OAuth 2.0 client ID...**, and configure these " .
20
+ "settings: " .
21
+ "\n\n" .
22
+ " - During initial setup click **More Options** (or after creating " .
23
+ " the client ID, click **Edit Settings...**), then add this to " .
24
+ " **Authorized Redirect URIs**: `%s` \n" .
25
+ "\n\n" .
26
+ "After completing configuration, copy the **Client ID** and " .
27
+ "**Client Secret** to the fields above. " ,
28
+ $ login_uri );
29
+ }
30
+
10
31
protected function newOAuthAdapter () {
11
32
return new PhutilAuthAdapterOAuthGoogle ();
12
33
}
Original file line number Diff line number Diff line change @@ -9,6 +9,12 @@ public function getProviderName() {
9
9
return pht ('Username/Password ' );
10
10
}
11
11
12
+ public function getConfigurationHelp () {
13
+ return pht (
14
+ 'You can select a minimum password length by setting ' .
15
+ '`account.minimum-password-length` in configuration. ' );
16
+ }
17
+
12
18
public function getDescriptionForCreate () {
13
19
return pht (
14
20
'Allow users to login or register using a username and password. ' );
@@ -227,4 +233,16 @@ public function willRegisterAccount(PhabricatorExternalAccount $account) {
227
233
$ account ->setAccountID ($ account ->getUserPHID ());
228
234
}
229
235
236
+ public static function getPasswordProvider () {
237
+ $ providers = self ::getAllEnabledProviders ();
238
+
239
+ foreach ($ providers as $ provider ) {
240
+ if ($ provider instanceof PhabricatorAuthProviderPassword) {
241
+ return $ provider ;
242
+ }
243
+ }
244
+
245
+ return null ;
246
+ }
247
+
230
248
}
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ final public function willBeginExecution() {
101
101
102
102
if ($ this ->shouldRequireLogin () && !$ user ->getPHID ()) {
103
103
$ login_controller = new PhabricatorAuthStartController ($ request );
104
- $ login_controller ->setCurrentApplication (
104
+ $ this ->setCurrentApplication (
105
105
PhabricatorApplication::getByClass ('PhabricatorApplicationAuth ' ));
106
106
return $ this ->delegateToController ($ login_controller );
107
107
}
Original file line number Diff line number Diff line change @@ -13,19 +13,6 @@ public function getDescription() {
13
13
14
14
public function getOptions () {
15
15
return array (
16
- $ this ->newOption (
17
- 'auth.password-auth-enabled ' , 'bool ' , true )
18
- ->setBoolOptions (
19
- array (
20
- pht ("Allow password authentication " ),
21
- pht ("Don't allow password authentication " )
22
- ))
23
- ->setSummary (pht ("Enables password-based authentication. " ))
24
- ->setDescription (
25
- pht (
26
- "Can users login with a username/password, or by following the " .
27
- "link from a password reset email? You can disable this and " .
28
- "configure one or more OAuth providers instead. " )),
29
16
$ this ->newOption ('auth.sessions.web ' , 'int ' , 5 )
30
17
->setSummary (
31
18
pht ("Number of web sessions a user can have simultaneously. " ))
Original file line number Diff line number Diff line change @@ -47,12 +47,6 @@ public function getOptions() {
47
47
->setBaseClass ('AphrontApplicationConfiguration ' )
48
48
// TODO: This could probably use some better documentation.
49
49
->setDescription (pht ("Application configuration class. " )),
50
- $ this ->newOption (
51
- 'controller.oauth-registration ' ,
52
- 'class ' ,
53
- 'PhabricatorOAuthDefaultRegistrationController ' )
54
- ->setBaseClass ('PhabricatorOAuthRegistrationController ' )
55
- ->setDescription (pht ("OAuth registration controller. " )),
56
50
);
57
51
}
58
52
Original file line number Diff line number Diff line change @@ -612,7 +612,7 @@ public function sendUsernameChangeEmail(
612
612
$ new_username = $ this ->getUserName ();
613
613
614
614
$ password_instructions = null ;
615
- if (PhabricatorEnv:: getEnvConfig ( ' auth.password-auth-enabled ' )) {
615
+ if (PhabricatorAuthProviderPassword:: getPasswordProvider ( )) {
616
616
$ uri = $ this ->getEmailLoginURI ();
617
617
$ password_instructions = <<<EOTXT
618
618
If you use a password to login, you'll need to reset it before you can login
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public function isEnabled() {
25
25
26
26
// ...or this install doesn't support password authentication at all.
27
27
28
- if (!PhabricatorEnv:: getEnvConfig ( ' auth.password-auth-enabled ' )) {
28
+ if (!PhabricatorAuthProviderPassword:: getPasswordProvider ( )) {
29
29
return false ;
30
30
}
31
31
Original file line number Diff line number Diff line change @@ -150,8 +150,11 @@ Now, navigate to whichever subdomain you set up. You should see instructions to
150
150
continue setup. The rest of this document contains additional instructions for
151
151
specific setup steps.
152
152
153
- When you see the login screen, continue with @{article:Configuring Accounts and
154
- Registration}.
153
+ When you resolve any issues and see the welcome screen, enter credentials to
154
+ create your initial administrator account. After you log in, you'll want to
155
+ configure how other users will be able to log in or register -- until you do,
156
+ no one else will be able to sign up or log in. For more information, see
157
+ @{article:Configuring Accounts and Registration}.
155
158
156
159
= Storage: Configuring MySQL =
157
160
0 commit comments