mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-01 18:30:59 +01:00
Allow "bin/auth recover" to succeed before phabricator.base-uri is set
Summary: Fixes T4132. If you run "bin/auth recover" before setting the base URI, it throws when trying to generate a production URI. Instead, just show the path. We can't figure out the domain, and I think this is less confusing than showing "your.phabricator.example.com", etc. Test Plan: Ran `bin/auth recover <user>` for valid and missing base-uri. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T4132 Differential Revision: https://secure.phabricator.com/D7615
This commit is contained in:
parent
91d084624b
commit
6eb02af314
2 changed files with 13 additions and 2 deletions
|
@ -72,7 +72,8 @@ final class PhabricatorAuthManagementRecoverWorkflow
|
||||||
$console = PhutilConsole::getConsole();
|
$console = PhutilConsole::getConsole();
|
||||||
$console->writeOut(
|
$console->writeOut(
|
||||||
pht(
|
pht(
|
||||||
'Use this link to recover access to the "%s" account:',
|
'Use this link to recover access to the "%s" account from the web '.
|
||||||
|
'interface:',
|
||||||
$username));
|
$username));
|
||||||
$console->writeOut("\n\n");
|
$console->writeOut("\n\n");
|
||||||
$console->writeOut(" %s", $user->getEmailLoginURI());
|
$console->writeOut(" %s", $user->getEmailLoginURI());
|
||||||
|
|
|
@ -495,8 +495,18 @@ final class PhabricatorUser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$token = $this->generateEmailToken($email);
|
$token = $this->generateEmailToken($email);
|
||||||
$uri = PhabricatorEnv::getProductionURI('/login/etoken/'.$token.'/');
|
|
||||||
|
$uri = '/login/etoken/'.$token.'/';
|
||||||
|
try {
|
||||||
|
$uri = PhabricatorEnv::getProductionURI($uri);
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
// If a user runs `bin/auth recover` before configuring the base URI,
|
||||||
|
// just show the path. We don't have any way to figure out the domain.
|
||||||
|
// See T4132.
|
||||||
|
}
|
||||||
|
|
||||||
$uri = new PhutilURI($uri);
|
$uri = new PhutilURI($uri);
|
||||||
|
|
||||||
return $uri->alter('email', $email->getAddress());
|
return $uri->alter('email', $email->getAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue