Add first-time-setup registration flow
Summary:
Ref T1536. Currently, when you install Phabricator you're dumped on the login screen and have to consult the documentation to learn about `bin/accountadmin`.
Instead, detect that an install is running first-time setup:
- It has no configured providers; and
- it has no user accounts.
We can safely deduce that such an install isn't configured yet, and let the user create an admin account from the web UI.
After they login, we raise a setup issue and lead them to configure authentication.
(This could probably use some UI and copy tweaks.)
Test Plan:
{F46738}
{F46739}
Reviewers: chad, btrahan
Reviewed By: chad
CC: aran
Maniphest Tasks: T1536
Differential Revision: https://secure.phabricator.com/D6228
This commit is contained in:
@@ -29,6 +29,28 @@ abstract class PhabricatorAuthController extends PhabricatorController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this install is newly setup (i.e., there are no user
|
||||
* accounts yet). In this case, we enter a special mode to permit creation
|
||||
* of the first account form the web UI.
|
||||
*/
|
||||
protected function isFirstTimeSetup() {
|
||||
// If there are any auth providers, this isn't first time setup, even if
|
||||
// we don't have accounts.
|
||||
if (PhabricatorAuthProvider::getAllEnabledProviders()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Otherwise, check if there are any user accounts. If not, we're in first
|
||||
// time setup.
|
||||
$any_users = id(new PhabricatorPeopleQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->setLimit(1)
|
||||
->execute();
|
||||
|
||||
return !$any_users;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Log a user into a web session and return an @{class:AphrontResponse} which
|
||||
|
||||
Reference in New Issue
Block a user