From 4910a36563a6465f494cb90b906fcda8ed44863d Mon Sep 17 00:00:00 2001 From: Saulius Zemaitaitis Date: Fri, 22 Nov 2013 11:22:25 -0800 Subject: [PATCH] Set reasonable defaults when displaying remote repository URIs. Summary: Show SSH user on git-over-ssh repositories and hide both username and password for other repos. Test Plan: View repository details page in diffusion, Clone URI should appear with a username (taken from repo config) and any http(s) repos should be without usernames. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley CC: Korvin, epriestley, aran Maniphest Tasks: T4147 Differential Revision: https://secure.phabricator.com/D7631 --- .../repository/storage/PhabricatorRepository.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php index c8601e6729..c77a6a62c7 100644 --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -580,14 +580,10 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO // Make sure we don't leak anything if this repo is using HTTP Basic Auth // with the credentials in the URI or something zany like that. - if ($uri instanceof PhutilGitURI) { - if (!$this->getDetail('show-user', false)) { - $uri->setUser(null); - } - } else { - if (!$this->getDetail('show-user', false)) { - $uri->setUser(null); - } + // If repository is not accessed over SSH we remove both username and + // password. + if (!$this->shouldUseSSH()) { + $uri->setUser(null); $uri->setPass(null); }