redirect ostatussub if not logged in

This commit is contained in:
Evan Prodromou 2010-02-21 11:24:04 -05:00
parent df7c6b37c8
commit 727773cdfa

View File

@ -58,7 +58,6 @@ class OStatusSubAction extends Action
$this->showPage(); $this->showPage();
} }
/** /**
* Content area of the page * Content area of the page
* *
@ -116,7 +115,18 @@ class OStatusSubAction extends Action
function prepare($args) function prepare($args)
{ {
parent::prepare($args); parent::prepare($args);
if (!common_logged_in()) {
// XXX: selfURL() didn't work. :<
common_set_returnto($_SERVER['REQUEST_URI']);
if (Event::handle('RedirectToLogin', array($this, null))) {
common_redirect(common_local_url('login'), 303);
}
return false;
}
$this->profile_uri = $this->arg('profile'); $this->profile_uri = $this->arg('profile');
return true; return true;
} }
@ -173,13 +183,13 @@ class OStatusSubAction extends Action
function validateFeed() function validateFeed()
{ {
$profile_uri = trim($this->arg('profile')); $profile_uri = trim($this->arg('profile'));
if ($profile_uri == '') { if ($profile_uri == '') {
$this->showForm(_m('Empty remote profile URL!')); $this->showForm(_m('Empty remote profile URL!'));
return; return;
} }
$this->profile_uri = $profile_uri; $this->profile_uri = $profile_uri;
// @fixme validate, normalize bla bla // @fixme validate, normalize bla bla
try { try {
$oprofile = Ostatus_profile::ensureProfile($this->profile_uri); $oprofile = Ostatus_profile::ensureProfile($this->profile_uri);