Page MenuHomePhabricator

D13748.id33263.diff
No OneTemporary

D13748.id33263.diff

diff --git a/src/applications/auth/controller/PhabricatorAuthConfirmLinkController.php b/src/applications/auth/controller/PhabricatorAuthConfirmLinkController.php
--- a/src/applications/auth/controller/PhabricatorAuthConfirmLinkController.php
+++ b/src/applications/auth/controller/PhabricatorAuthConfirmLinkController.php
@@ -3,17 +3,11 @@
final class PhabricatorAuthConfirmLinkController
extends PhabricatorAuthController {
- private $accountKey;
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $accountkey = $request->getURIData('akey');
- public function willProcessRequest(array $data) {
- $this->accountKey = idx($data, 'akey');
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
-
- $result = $this->loadAccountForRegistrationOrLinking($this->accountKey);
+ $result = $this->loadAccountForRegistrationOrLinking($accountkey);
list($account, $provider, $response) = $result;
if ($response) {
diff --git a/src/applications/auth/controller/PhabricatorAuthDowngradeSessionController.php b/src/applications/auth/controller/PhabricatorAuthDowngradeSessionController.php
--- a/src/applications/auth/controller/PhabricatorAuthDowngradeSessionController.php
+++ b/src/applications/auth/controller/PhabricatorAuthDowngradeSessionController.php
@@ -3,9 +3,8 @@
final class PhabricatorAuthDowngradeSessionController
extends PhabricatorAuthController {
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
$panel_uri = '/settings/panel/sessions/';
diff --git a/src/applications/auth/controller/PhabricatorAuthFinishController.php b/src/applications/auth/controller/PhabricatorAuthFinishController.php
--- a/src/applications/auth/controller/PhabricatorAuthFinishController.php
+++ b/src/applications/auth/controller/PhabricatorAuthFinishController.php
@@ -15,9 +15,8 @@
return true;
}
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
// If the user already has a full session, just kick them out of here.
$has_partial_session = $viewer->hasSession() &&
diff --git a/src/applications/auth/controller/PhabricatorAuthLinkController.php b/src/applications/auth/controller/PhabricatorAuthLinkController.php
--- a/src/applications/auth/controller/PhabricatorAuthLinkController.php
+++ b/src/applications/auth/controller/PhabricatorAuthLinkController.php
@@ -3,25 +3,18 @@
final class PhabricatorAuthLinkController
extends PhabricatorAuthController {
- private $action;
- private $providerKey;
-
- public function willProcessRequest(array $data) {
- $this->providerKey = $data['pkey'];
- $this->action = $data['action'];
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $action = $request->getURIData('action');
+ $provider_key = $request->getURIData('pkey');
$provider = PhabricatorAuthProvider::getEnabledProviderByKey(
- $this->providerKey);
+ $provider_key);
if (!$provider) {
return new Aphront404Response();
}
- switch ($this->action) {
+ switch ($action) {
case 'link':
if (!$provider->shouldAllowAccountLink()) {
return $this->renderErrorPage(
@@ -50,7 +43,7 @@
$provider->getProviderDomain(),
$viewer->getPHID());
- switch ($this->action) {
+ switch ($action) {
case 'link':
if ($account) {
return $this->renderErrorPage(
@@ -81,7 +74,7 @@
PhabricatorCookies::setClientIDCookie($request);
- switch ($this->action) {
+ switch ($action) {
case 'link':
id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
$viewer,
@@ -107,7 +100,7 @@
$form);
}
- switch ($this->action) {
+ switch ($action) {
case 'link':
$name = pht('Link Account');
$title = pht('Link %s Account', $provider->getProviderName());
diff --git a/src/applications/auth/controller/PhabricatorAuthLoginController.php b/src/applications/auth/controller/PhabricatorAuthLoginController.php
--- a/src/applications/auth/controller/PhabricatorAuthLoginController.php
+++ b/src/applications/auth/controller/PhabricatorAuthLoginController.php
@@ -20,18 +20,14 @@
return parent::shouldAllowRestrictedParameter($parameter_name);
}
- public function willProcessRequest(array $data) {
- $this->providerKey = $data['pkey'];
- $this->extraURIData = idx($data, 'extra');
- }
-
public function getExtraURIData() {
return $this->extraURIData;
}
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $this->providerKey = $request->getURIData('pkey');
+ $this->extraURIData = $request->getURIData('extra');
$response = $this->loadProvider();
if ($response) {
diff --git a/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php b/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php
--- a/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php
+++ b/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php
@@ -15,16 +15,15 @@
return false;
}
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
$wait_for_approval = pht(
"Your account has been created, but needs to be approved by an ".
"administrator. You'll receive an email once your account is approved.");
$dialog = id(new AphrontDialogView())
- ->setUser($user)
+ ->setUser($viewer)
->setTitle(pht('Wait for Approval'))
->appendChild($wait_for_approval)
->addCancelButton('/', pht('Wait Patiently'));
diff --git a/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php b/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php
--- a/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php
+++ b/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php
@@ -9,9 +9,8 @@
return false;
}
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
$panel = id(new PhabricatorMultiFactorSettingsPanel())
->setUser($viewer)
diff --git a/src/applications/auth/controller/PhabricatorAuthOldOAuthRedirectController.php b/src/applications/auth/controller/PhabricatorAuthOldOAuthRedirectController.php
--- a/src/applications/auth/controller/PhabricatorAuthOldOAuthRedirectController.php
+++ b/src/applications/auth/controller/PhabricatorAuthOldOAuthRedirectController.php
@@ -3,8 +3,6 @@
final class PhabricatorAuthOldOAuthRedirectController
extends PhabricatorAuthController {
- private $provider;
-
public function shouldRequireLogin() {
return false;
}
@@ -16,11 +14,9 @@
return parent::shouldAllowRestrictedParameter($parameter_name);
}
- public function willProcessRequest(array $data) {
- $this->provider = $data['provider'];
- }
-
- public function processRequest() {
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $provider = $request->getURIData('provider');
// TODO: Most OAuth providers are OK with changing the redirect URI, but
// Google and GitHub are strict. We need to respect the old OAuth URI until
// we can get installs to migrate. This just keeps the old OAuth URI working
@@ -31,11 +27,11 @@
'github' => 'github:github.com',
);
- if (!isset($provider_map[$this->provider])) {
+ if (!isset($provider_map[$provider])) {
return new Aphront404Response();
}
- $provider_key = $provider_map[$this->provider];
+ $provider_key = $provider_map[$provider];
$uri = $this->getRequest()->getRequestURI();
$uri->setPath($this->getApplicationURI('login/'.$provider_key.'/'));
diff --git a/src/applications/auth/controller/PhabricatorAuthOneTimeLoginController.php b/src/applications/auth/controller/PhabricatorAuthOneTimeLoginController.php
--- a/src/applications/auth/controller/PhabricatorAuthOneTimeLoginController.php
+++ b/src/applications/auth/controller/PhabricatorAuthOneTimeLoginController.php
@@ -3,24 +3,16 @@
final class PhabricatorAuthOneTimeLoginController
extends PhabricatorAuthController {
- private $id;
- private $key;
- private $emailID;
- private $linkType;
-
public function shouldRequireLogin() {
return false;
}
- public function willProcessRequest(array $data) {
- $this->linkType = $data['type'];
- $this->id = $data['id'];
- $this->key = $data['key'];
- $this->emailID = idx($data, 'emailID');
- }
-
- public function processRequest() {
- $request = $this->getRequest();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $id = $request->getURIData('id');
+ $link_type = $request->getURIData('key');
+ $key = $request->getURIData('type');
+ $email_id = $request->getURIData('emailID');
if ($request->getUser()->isLoggedIn()) {
return $this->renderError(
@@ -29,7 +21,7 @@
$target_user = id(new PhabricatorPeopleQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
- ->withIDs(array($this->id))
+ ->withIDs(array($id))
->executeOne();
if (!$target_user) {
return new Aphront404Response();
@@ -58,11 +50,11 @@
// - get a "verified" address you don't control.
$target_email = null;
- if ($this->emailID) {
+ if ($email_id) {
$target_email = id(new PhabricatorUserEmail())->loadOneWhere(
'userPHID = %s AND id = %d',
$target_user->getPHID(),
- $this->emailID);
+ $email_id);
if (!$target_email) {
return new Aphront404Response();
}
@@ -72,7 +64,7 @@
$token = $engine->loadOneTimeLoginKey(
$target_user,
$target_email,
- $this->key);
+ $key);
if (!$token) {
return $this->newDialog()
@@ -154,7 +146,7 @@
// then log a user in to an account they control via sneaky invisible
// form submissions.
- switch ($this->linkType) {
+ switch ($link_type) {
case PhabricatorAuthSessionEngine::ONETIME_WELCOME:
$title = pht('Welcome to Phabricator');
break;
diff --git a/src/applications/auth/controller/PhabricatorAuthRegisterController.php b/src/applications/auth/controller/PhabricatorAuthRegisterController.php
--- a/src/applications/auth/controller/PhabricatorAuthRegisterController.php
+++ b/src/applications/auth/controller/PhabricatorAuthRegisterController.php
@@ -3,26 +3,21 @@
final class PhabricatorAuthRegisterController
extends PhabricatorAuthController {
- private $accountKey;
-
public function shouldRequireLogin() {
return false;
}
- public function willProcessRequest(array $data) {
- $this->accountKey = idx($data, 'akey');
- }
-
- public function processRequest() {
- $request = $this->getRequest();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $account_key = $request->getURIData('akey');
if ($request->getUser()->isLoggedIn()) {
return $this->renderError(pht('You are already logged in.'));
}
$is_setup = false;
- if (strlen($this->accountKey)) {
- $result = $this->loadAccountForRegistrationOrLinking($this->accountKey);
+ if (strlen($account_key)) {
+ $result = $this->loadAccountForRegistrationOrLinking($account_key);
list($account, $provider, $response) = $result;
$is_default = false;
} else if ($this->isFirstTimeSetup()) {
diff --git a/src/applications/auth/controller/PhabricatorAuthRevokeTokenController.php b/src/applications/auth/controller/PhabricatorAuthRevokeTokenController.php
--- a/src/applications/auth/controller/PhabricatorAuthRevokeTokenController.php
+++ b/src/applications/auth/controller/PhabricatorAuthRevokeTokenController.php
@@ -3,23 +3,17 @@
final class PhabricatorAuthRevokeTokenController
extends PhabricatorAuthController {
- private $id;
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $id = $request->getURIData('id');
- public function willProcessRequest(array $data) {
- $this->id = $data['id'];
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
-
- $is_all = ($this->id === 'all');
+ $is_all = ($id === 'all');
$query = id(new PhabricatorAuthTemporaryTokenQuery())
->setViewer($viewer)
->withObjectPHIDs(array($viewer->getPHID()));
if (!$is_all) {
- $query->withIDs(array($this->id));
+ $query->withIDs(array($id));
}
$tokens = $query->execute();
diff --git a/src/applications/auth/controller/PhabricatorAuthSSHKeyEditController.php b/src/applications/auth/controller/PhabricatorAuthSSHKeyEditController.php
--- a/src/applications/auth/controller/PhabricatorAuthSSHKeyEditController.php
+++ b/src/applications/auth/controller/PhabricatorAuthSSHKeyEditController.php
@@ -5,8 +5,8 @@
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
-
$id = $request->getURIData('id');
+
if ($id) {
$key = id(new PhabricatorAuthSSHKeyQuery())
->setViewer($viewer)
diff --git a/src/applications/auth/controller/PhabricatorAuthTerminateSessionController.php b/src/applications/auth/controller/PhabricatorAuthTerminateSessionController.php
--- a/src/applications/auth/controller/PhabricatorAuthTerminateSessionController.php
+++ b/src/applications/auth/controller/PhabricatorAuthTerminateSessionController.php
@@ -3,23 +3,17 @@
final class PhabricatorAuthTerminateSessionController
extends PhabricatorAuthController {
- private $id;
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $id = $request->getURIData('id');
- public function willProcessRequest(array $data) {
- $this->id = $data['id'];
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
-
- $is_all = ($this->id === 'all');
+ $is_all = ($id === 'all');
$query = id(new PhabricatorAuthSessionQuery())
->setViewer($viewer)
->withIdentityPHIDs(array($viewer->getPHID()));
if (!$is_all) {
- $query->withIDs(array($this->id));
+ $query->withIDs(array($id));
}
$current_key = PhabricatorHash::digest(
diff --git a/src/applications/auth/controller/PhabricatorAuthUnlinkController.php b/src/applications/auth/controller/PhabricatorAuthUnlinkController.php
--- a/src/applications/auth/controller/PhabricatorAuthUnlinkController.php
+++ b/src/applications/auth/controller/PhabricatorAuthUnlinkController.php
@@ -5,13 +5,9 @@
private $providerKey;
- public function willProcessRequest(array $data) {
- $this->providerKey = $data['pkey'];
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $this->providerKey = $request->getURIData('pkey');
list($type, $domain) = explode(':', $this->providerKey, 2);
diff --git a/src/applications/auth/controller/PhabricatorAuthValidateController.php b/src/applications/auth/controller/PhabricatorAuthValidateController.php
--- a/src/applications/auth/controller/PhabricatorAuthValidateController.php
+++ b/src/applications/auth/controller/PhabricatorAuthValidateController.php
@@ -15,9 +15,8 @@
return true;
}
- public function processRequest() {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
$failures = array();
diff --git a/src/applications/auth/controller/PhabricatorDisabledUserController.php b/src/applications/auth/controller/PhabricatorDisabledUserController.php
--- a/src/applications/auth/controller/PhabricatorDisabledUserController.php
+++ b/src/applications/auth/controller/PhabricatorDisabledUserController.php
@@ -7,15 +7,16 @@
return false;
}
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
- if (!$user->getIsDisabled()) {
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $id = $request->getURIData('id');
+
+ if (!$viewer->getIsDisabled()) {
return new Aphront404Response();
}
return id(new AphrontDialogView())
- ->setUser($user)
+ ->setUser($viewer)
->setTitle(pht('Account Disabled'))
->addCancelButton('/logout/', pht('Okay'))
->appendParagraph(pht('Your account has been disabled.'));
diff --git a/src/applications/auth/controller/PhabricatorEmailLoginController.php b/src/applications/auth/controller/PhabricatorEmailLoginController.php
--- a/src/applications/auth/controller/PhabricatorEmailLoginController.php
+++ b/src/applications/auth/controller/PhabricatorEmailLoginController.php
@@ -7,8 +7,7 @@
return false;
}
- public function processRequest() {
- $request = $this->getRequest();
+ public function handleRequest(AphrontRequest $request) {
if (!PhabricatorPasswordAuthProvider::getPasswordProvider()) {
return new Aphront400Response();
diff --git a/src/applications/auth/controller/PhabricatorEmailVerificationController.php b/src/applications/auth/controller/PhabricatorEmailVerificationController.php
--- a/src/applications/auth/controller/PhabricatorEmailVerificationController.php
+++ b/src/applications/auth/controller/PhabricatorEmailVerificationController.php
@@ -3,12 +3,6 @@
final class PhabricatorEmailVerificationController
extends PhabricatorAuthController {
- private $code;
-
- public function willProcessRequest(array $data) {
- $this->code = $data['code'];
- }
-
public function shouldRequireEmailVerification() {
// Since users need to be able to hit this endpoint in order to verify
// email, we can't ever require email verification here.
@@ -21,11 +15,11 @@
return false;
}
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $code = $request->getURIData('code');
- if ($user->getIsDisabled()) {
+ if ($viewer->getIsDisabled()) {
// We allowed unapproved and disabled users to hit this controller, but
// want to kick out disabled users now.
return new Aphront400Response();
@@ -33,8 +27,8 @@
$email = id(new PhabricatorUserEmail())->loadOneWhere(
'userPHID = %s AND verificationCode = %s',
- $user->getPHID(),
- $this->code);
+ $viewer->getPHID(),
+ $code);
$submit = null;
@@ -46,7 +40,7 @@
'user. Make sure you followed the link in the email correctly and are '.
'logged in with the user account associated with the email address.');
$continue = pht('Rats!');
- } else if ($email->getIsVerified() && $user->getIsEmailVerified()) {
+ } else if ($email->getIsVerified() && $viewer->getIsEmailVerified()) {
$title = pht('Address Already Verified');
$content = pht(
'This email address has already been verified.');
@@ -54,8 +48,8 @@
} else if ($request->isFormPost()) {
id(new PhabricatorUserEditor())
- ->setActor($user)
- ->verifyEmail($user, $email);
+ ->setActor($viewer)
+ ->verifyEmail($viewer, $email);
$title = pht('Address Verified');
$content = pht(
@@ -72,7 +66,7 @@
}
$dialog = id(new AphrontDialogView())
- ->setUser($user)
+ ->setUser($viewer)
->setTitle($title)
->addCancelButton('/', $continue)
->appendChild($content);
diff --git a/src/applications/auth/controller/PhabricatorLogoutController.php b/src/applications/auth/controller/PhabricatorLogoutController.php
--- a/src/applications/auth/controller/PhabricatorLogoutController.php
+++ b/src/applications/auth/controller/PhabricatorLogoutController.php
@@ -26,14 +26,13 @@
}
public function handleRequest(AphrontRequest $request) {
- $request = $this->getRequest();
- $user = $request->getUser();
+ $viewer = $this->getViewer();
if ($request->isFormPost()) {
$log = PhabricatorUserLog::initializeNewLog(
- $user,
- $user->getPHID(),
+ $viewer,
+ $viewer->getPHID(),
PhabricatorUserLog::ACTION_LOGOUT);
$log->save();
@@ -43,7 +42,7 @@
$phsid = $request->getCookie(PhabricatorCookies::COOKIE_SESSION);
if (strlen($phsid)) {
$session = id(new PhabricatorAuthSessionQuery())
- ->setViewer($user)
+ ->setViewer($viewer)
->withSessionKeys(array($phsid))
->executeOne();
if ($session) {
@@ -56,9 +55,9 @@
->setURI('/auth/loggedout/');
}
- if ($user->getPHID()) {
+ if ($viewer->getPHID()) {
$dialog = id(new AphrontDialogView())
- ->setUser($user)
+ ->setUser($viewer)
->setTitle(pht('Log out of Phabricator?'))
->appendChild(pht('Are you sure you want to log out?'))
->addSubmitButton(pht('Logout'))
diff --git a/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php b/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php
--- a/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php
+++ b/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php
@@ -13,13 +13,12 @@
return false;
}
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
- $email = $user->loadPrimaryEmail();
+ $email = $viewer->loadPrimaryEmail();
- if ($user->getIsEmailVerified()) {
+ if ($viewer->getIsEmailVerified()) {
return id(new AphrontRedirectResponse())->setURI('/');
}
@@ -27,7 +26,7 @@
$sent = null;
if ($request->isFormPost()) {
- $email->sendVerificationEmail($user);
+ $email->sendVerificationEmail($viewer);
$sent = new PHUIInfoView();
$sent->setSeverity(PHUIInfoView::SEVERITY_NOTICE);
$sent->setTitle(pht('Email Sent'));
@@ -48,7 +47,7 @@
'to try sending another one.');
$dialog = id(new AphrontDialogView())
- ->setUser($user)
+ ->setUser($viewer)
->setTitle(pht('Check Your Email'))
->appendParagraph($must_verify)
->appendParagraph($send_again)
diff --git a/src/applications/auth/controller/PhabricatorRefreshCSRFController.php b/src/applications/auth/controller/PhabricatorRefreshCSRFController.php
--- a/src/applications/auth/controller/PhabricatorRefreshCSRFController.php
+++ b/src/applications/auth/controller/PhabricatorRefreshCSRFController.php
@@ -2,14 +2,13 @@
final class PhabricatorRefreshCSRFController extends PhabricatorAuthController {
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
return id(new AphrontAjaxResponse())
->setContent(
array(
- 'token' => $user->getCSRFToken(),
+ 'token' => $viewer->getCSRFToken(),
));
}

File Metadata

Mime Type
text/plain
Expires
Thu, May 16, 3:10 PM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6276708
Default Alt Text
D13748.id33263.diff (23 KB)

Event Timeline