mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Clean up redirect URIs for "Temporary Tokens" and "API Tokens" settings panels
Summary: Fixes T11223. I missed a few of these; most of them kept working anyway because we have redirects in place, but make them a bit more modern/not-hard-coded. Test Plan: - Generated and revoked API tokens for myself. - Generated and revoked API tokens for bots. - Revoked temporary tokens for myself. - Clicked the link to the API tokens panel from the Conduit console. - Clicked all the cancel buttons in all the dialogs, too. In all cases, everything now points at the correct URIs. Previously, some things pointed at the wrong URIs (mostly dealing with stuff for bots). Reviewers: chad Reviewed By: chad Maniphest Tasks: T11223 Differential Revision: https://secure.phabricator.com/D16185
This commit is contained in:
parent
84ce863116
commit
ec8581ab62
4 changed files with 23 additions and 10 deletions
|
@ -24,7 +24,10 @@ final class PhabricatorAuthRevokeTokenController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$panel_uri = '/settings/panel/tokens/';
|
$panel_uri = id(new PhabricatorTokensSettingsPanel())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->setUser($viewer)
|
||||||
|
->getPanelURI();
|
||||||
|
|
||||||
if (!$tokens) {
|
if (!$tokens) {
|
||||||
return $this->newDialog()
|
return $this->newDialog()
|
||||||
|
|
|
@ -25,6 +25,8 @@ abstract class PhabricatorConduitController extends PhabricatorController {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function renderExampleBox(ConduitAPIMethod $method, $params) {
|
protected function renderExampleBox(ConduitAPIMethod $method, $params) {
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
$arc_example = id(new PHUIPropertyListView())
|
$arc_example = id(new PHUIPropertyListView())
|
||||||
->addRawContent($this->renderExample($method, 'arc', $params));
|
->addRawContent($this->renderExample($method, 'arc', $params));
|
||||||
|
|
||||||
|
@ -34,10 +36,15 @@ abstract class PhabricatorConduitController extends PhabricatorController {
|
||||||
$php_example = id(new PHUIPropertyListView())
|
$php_example = id(new PHUIPropertyListView())
|
||||||
->addRawContent($this->renderExample($method, 'php', $params));
|
->addRawContent($this->renderExample($method, 'php', $params));
|
||||||
|
|
||||||
|
$panel_uri = id(new PhabricatorConduitTokensSettingsPanel())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->setUser($viewer)
|
||||||
|
->getPanelURI();
|
||||||
|
|
||||||
$panel_link = phutil_tag(
|
$panel_link = phutil_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
'href' => '/settings/panel/apitokens/',
|
'href' => $panel_uri,
|
||||||
),
|
),
|
||||||
pht('Conduit API Tokens'));
|
pht('Conduit API Tokens'));
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,10 @@ final class PhabricatorConduitTokenEditController
|
||||||
$submit_button = pht('Generate Token');
|
$submit_button = pht('Generate Token');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($viewer->getPHID() == $object->getPHID()) {
|
$panel_uri = id(new PhabricatorConduitTokensSettingsPanel())
|
||||||
$panel_uri = '/settings/panel/apitokens/';
|
->setViewer($viewer)
|
||||||
} else {
|
->setUser($object)
|
||||||
$panel_uri = '/settings/'.$object->getID().'/panel/apitokens/';
|
->getPanelURI();
|
||||||
}
|
|
||||||
|
|
||||||
id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
|
id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
|
||||||
$viewer,
|
$viewer,
|
||||||
|
|
|
@ -31,7 +31,6 @@ final class PhabricatorConduitTokenTerminateController
|
||||||
'Really terminate this token? Any system using this token '.
|
'Really terminate this token? Any system using this token '.
|
||||||
'will no longer be able to make API requests.');
|
'will no longer be able to make API requests.');
|
||||||
$submit_button = pht('Terminate Token');
|
$submit_button = pht('Terminate Token');
|
||||||
$panel_uri = '/settings/panel/apitokens/';
|
|
||||||
} else {
|
} else {
|
||||||
$tokens = id(new PhabricatorConduitTokenQuery())
|
$tokens = id(new PhabricatorConduitTokenQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
|
@ -51,7 +50,6 @@ final class PhabricatorConduitTokenTerminateController
|
||||||
$submit_button = pht('Terminate Tokens');
|
$submit_button = pht('Terminate Tokens');
|
||||||
}
|
}
|
||||||
|
|
||||||
$panel_uri = '/settings/panel/apitokens/';
|
|
||||||
if ($object_phid != $viewer->getPHID()) {
|
if ($object_phid != $viewer->getPHID()) {
|
||||||
$object = id(new PhabricatorObjectQuery())
|
$object = id(new PhabricatorObjectQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
|
@ -60,9 +58,15 @@ final class PhabricatorConduitTokenTerminateController
|
||||||
if (!$object) {
|
if (!$object) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
$panel_uri = '/settings/'.$object->getID().'/panel/apitokens/';
|
} else {
|
||||||
|
$object = $viewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$panel_uri = id(new PhabricatorConduitTokensSettingsPanel())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->setUser($object)
|
||||||
|
->getPanelURI();
|
||||||
|
|
||||||
id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
|
id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
|
||||||
$viewer,
|
$viewer,
|
||||||
$request,
|
$request,
|
||||||
|
|
Loading…
Reference in a new issue