diff --git a/conf/aphlict/aphlict.default.json b/conf/aphlict/aphlict.default.json index 7afdf7e8ff..0160b65679 100644 --- a/conf/aphlict/aphlict.default.json +++ b/conf/aphlict/aphlict.default.json @@ -22,5 +22,5 @@ "path": "/var/log/aphlict.log" } ], - "pidfile": "/var/tmp/aphlict/pid/aphlict.pid" + "pidfile": "/var/run/aphlict/aphlict.pid" } diff --git a/src/applications/auth/controller/PhabricatorAuthRegisterController.php b/src/applications/auth/controller/PhabricatorAuthRegisterController.php index 1138d52b33..136671630a 100644 --- a/src/applications/auth/controller/PhabricatorAuthRegisterController.php +++ b/src/applications/auth/controller/PhabricatorAuthRegisterController.php @@ -7,6 +7,13 @@ public function shouldRequireLogin() { return false; } + private function emailToUsername($email) { + $mangled_email = str_ireplace('@freebsd.org', '', $email); + $mangled_email = str_replace('@', '_', $mangled_email); + $mangled_email = str_replace('+', '_', $mangled_email); + return $mangled_email; + } + public function handleRequest(AphrontRequest $request) { $viewer = $this->getViewer(); $account_key = $request->getURIData('akey'); @@ -58,7 +65,7 @@ public function handleRequest(AphrontRequest $request) { $user = new PhabricatorUser(); - $default_username = $account->getUsername(); + $fbsd_username = $this->emailToUsername($account->getEmail()); $default_realname = $account->getRealName(); $account_type = PhabricatorAuthPassword::PASSWORD_TYPE_ACCOUNT; @@ -186,7 +193,7 @@ public function handleRequest(AphrontRequest $request) { } $profile = id(new PhabricatorRegistrationProfile()) - ->setDefaultUsername($default_username) + ->setDefaultUsername($fbsd_username) ->setDefaultEmail($default_email) ->setDefaultRealName($default_realname) ->setCanEditUsername(true) @@ -204,11 +211,11 @@ public function handleRequest(AphrontRequest $request) { ->setUser($user); PhutilEventEngine::dispatchEvent($event); - $default_username = $profile->getDefaultUsername(); + $fbsd_username = $profile->getDefaultUsername(); $default_email = $profile->getDefaultEmail(); $default_realname = $profile->getDefaultRealName(); - $can_edit_username = $profile->getCanEditUsername(); + $can_edit_username = false; $can_edit_email = $profile->getCanEditEmail(); $can_edit_realname = $profile->getCanEditRealName(); @@ -223,7 +230,7 @@ public function handleRequest(AphrontRequest $request) { $force_verify = true; } - $value_username = $default_username; + $value_username = $fbsd_username; $value_realname = $default_realname; $value_email = $default_email; $value_password = null; @@ -323,6 +330,10 @@ public function handleRequest(AphrontRequest $request) { } } + if ($account->getAccountType() != 'ldap') { + $value_username = $this->emailToUsername($value_email); + } + if ($can_edit_realname) { $value_realname = $request->getStr('realName'); if (!strlen($value_realname) && $require_real_name) { @@ -488,14 +499,12 @@ public function handleRequest(AphrontRequest $request) { id(new AphrontFormTextControl()) ->setLabel(pht('Username')) ->setName('username') - ->setValue($value_username) - ->setError($e_username)); + ->setValue($value_username)); } else { $form->appendChild( id(new AphrontFormMarkupControl()) ->setLabel(pht('Username')) - ->setValue($value_username) - ->setError($e_username)); + ->setValue('automatically set based on email address')); } if ($can_edit_realname) { @@ -530,7 +539,7 @@ public function handleRequest(AphrontRequest $request) { ->setLabel(pht('Email')) ->setName('email') ->setValue($value_email) - ->setCaption(PhabricatorUserEmail::describeAllowedAddresses()) + ->setCaption(pht('public information')) ->setError($e_email)); } diff --git a/src/applications/differential/render/DifferentialChangesetRenderer.php b/src/applications/differential/render/DifferentialChangesetRenderer.php index 450d160e23..2b61654cce 100644 --- a/src/applications/differential/render/DifferentialChangesetRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetRenderer.php @@ -366,11 +366,19 @@ final public function renderChangesetTable($content) { // TODO: Let the user customize their tab width / display style. // TODO: We should possibly post-process "\r" as well. // TODO: Both these steps should happen earlier. - $result = str_replace("\t", ' ', $result); + $result = $this->expandLineTabs($result); return phutil_safe_html($result); } + private function expandLineTabs($line, $tab_size = 8) { + while (false !== ($pos = strpos($line, "\t"))) { + $expanded_tab = str_repeat(' ', $tab_size - ($pos % $tab_size)); + $line = substr_replace($line, $expanded_tab, $pos, 1); + } + return $line; + } + abstract public function isOneUpRenderer(); abstract public function renderTextChange( $range_start, diff --git a/webroot/index.php b/webroot/index.php index 5c7d79bfa1..de53f651ed 100644 --- a/webroot/index.php +++ b/webroot/index.php @@ -47,6 +47,7 @@ function phabricator_startup() { // If the preamble script exists, load it. $t_preamble = microtime(true); $preamble_path = $root.'/support/preamble.php'; + $_SERVER['HTTPS'] = true; if (file_exists($preamble_path)) { require_once $preamble_path; }