mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 00:02:41 +01:00
30 lines
719 B
PHP
30 lines
719 B
PHP
|
<?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);
|
||
|
}
|
||
|
|
||
|
}
|