Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/aphlict/aphlict.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
"path": "/var/log/aphlict.log"
}
],
"pidfile": "/var/tmp/aphlict/pid/aphlict.pid"
"pidfile": "/var/run/aphlict/aphlict.pid"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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();

Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions webroot/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down