diff --git a/src/applications/repository/controller/PhabricatorRepositoryEditController.php b/src/applications/repository/controller/PhabricatorRepositoryEditController.php index 0a1a0ca364..b4824bd4bc 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryEditController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryEditController.php @@ -265,6 +265,8 @@ final class PhabricatorRepositoryEditController $repository->setDetail('http-login', $request->getStr('http-login')); $repository->setDetail('http-pass', $request->getStr('http-pass')); + $repository->setDetail('show-user', $request->getInt('show-user')); + if ($repository->getDetail('ssh-key') && $repository->getDetail('ssh-keyfile')) { $errors[] = @@ -437,6 +439,14 @@ final class PhabricatorRepositoryEditController ->setValue($repository->getDetail('remote-uri')) ->setError($e_uri)); + $inset->appendChild( + id(new AphrontFormCheckboxControl()) + ->addCheckbox( + 'show-user', + 1, + pht('Permit users to view the username of this connection.'), + $repository->getDetail('show-user') == 1)); + $inset->appendChild(hsprintf( '
'. 'If you want to connect to this repository over SSH, enter the '. diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php index b6644a453a..ebc97a3813 100644 --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -434,9 +434,13 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO // with the credentials in the URI or something zany like that. if ($uri instanceof PhutilGitURI) { - $uri->setUser(null); + if (!$this->getDetail('show-user', false)) { + $uri->setUser(null); + } } else { - $uri->setUser(null); + if (!$this->getDetail('show-user', false)) { + $uri->setUser(null); + } $uri->setPass(null); }