1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 00:02:41 +01:00
phorge-phorge/src/applications/phortune/controller/PhortuneLandingController.php

30 lines
719 B
PHP
Raw Normal View History

2013-03-28 17:10:34 +01:00
<?php
final class PhortuneLandingController extends PhortuneController {
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$accounts = id(new PhortuneAccountQuery())
->setViewer($user)
->withMemberPHIDs(array($user->getPHID()))
->execute();
if (!$accounts) {
$account = $this->createUserAccount($user);
$accounts = array($account);
}
if (count($accounts) == 1) {
$account = head($accounts);
$next_uri = $this->getApplicationURI($account->getID().'/');
} else {
$next_uri = $this->getApplicationURI('account/');
}
return id(new AphrontRedirectResponse())->setURI($next_uri);
}
}