Update Auth for handleRequest

Summary: Updates Auth app for handleRequest

Test Plan: Tested what I could, Log in, Log out, Change Password, New account, Verify account... but extra eyes very helpful here.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T8628

Differential Revision: https://secure.phabricator.com/D13748
This commit is contained in:
Chad Little
2015-08-01 16:49:27 -07:00
parent 1d2c47f110
commit 36103dfa18
21 changed files with 95 additions and 159 deletions

View File

@@ -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 @@ final class PhabricatorAuthLinkController
$provider->getProviderDomain(),
$viewer->getPHID());
switch ($this->action) {
switch ($action) {
case 'link':
if ($account) {
return $this->renderErrorPage(
@@ -81,7 +74,7 @@ final class PhabricatorAuthLinkController
PhabricatorCookies::setClientIDCookie($request);
switch ($this->action) {
switch ($action) {
case 'link':
id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
$viewer,
@@ -107,7 +100,7 @@ final class PhabricatorAuthLinkController
$form);
}
switch ($this->action) {
switch ($action) {
case 'link':
$name = pht('Link Account');
$title = pht('Link %s Account', $provider->getProviderName());