Rework application registration workflow to be more private

This commit is contained in:
Zach Copley 2010-01-13 07:33:51 +00:00
parent 693b16174a
commit e101a6df6b
8 changed files with 58 additions and 92 deletions

View File

@ -125,10 +125,7 @@ class EditApplicationAction extends OwnerDesignAction
if ($this->arg('cancel')) {
common_redirect(common_local_url('showapplication',
array(
'nickname' => $cur->nickname,
'id' => $this->app->id)
), 303);
array('id' => $this->app->id)), 303);
} elseif ($this->arg('save')) {
$this->trySave();
} else {
@ -253,8 +250,7 @@ class EditApplicationAction extends OwnerDesignAction
$this->app->uploadLogo();
common_redirect(common_local_url('apps',
array('nickname' => $cur->nickname)), 303);
common_redirect(common_local_url('oauthappssettings'), 303);
}
}

View File

@ -114,8 +114,7 @@ class NewApplicationAction extends OwnerDesignAction
$cur = common_current_user();
if ($this->arg('cancel')) {
common_redirect(common_local_url('apps',
array('nickname' => $cur->nickname)), 303);
common_redirect(common_local_url('oauthappssettings'), 303);
} elseif ($this->arg('save')) {
$this->trySave();
} else {
@ -270,8 +269,7 @@ class NewApplicationAction extends OwnerDesignAction
$app->query('COMMIT');
common_redirect(common_local_url('apps',
array('nickname' => $cur->nickname)), 303);
common_redirect(common_local_url('oauthappssettings'), 303);
}

View File

@ -46,7 +46,7 @@ require_once INSTALLDIR . '/lib/applicationlist.php';
* @see SettingsAction
*/
class AppsAction extends SettingsAction
class OauthappssettingsAction extends SettingsAction
{
var $page = 0;
@ -116,10 +116,7 @@ class AppsAction extends SettingsAction
$this->elementStart('p', array('id' => 'application_register'));
$this->element('a',
array('href' => common_local_url(
'newapplication',
array('nickname' => $user->nickname)
),
array('href' => common_local_url('newapplication'),
'class' => 'more'
),
'Register a new application');
@ -129,8 +126,7 @@ class AppsAction extends SettingsAction
$this->page > 1,
$cnt > APPS_PER_PAGE,
$this->page,
'apps',
array('nickname' => $user->nickname)
'oauthappssettings'
);
}

View File

@ -158,7 +158,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
$this->elementStart('p');
$this->raw(_('Developers can edit the registration settings for their applications '));
$this->element('a',
array('href' => common_local_url('apps', array('nickname' => $cur->nickname))),
array('href' => common_local_url('oauthappssettings')),
'here.');
$this->elementEnd('p');
}

View File

@ -211,15 +211,9 @@ class ShowApplicationAction extends OwnerDesignAction
$this->elementStart('ul');
$this->elementStart('li', 'entity_edit');
$this->element('a',
array('href' =>
common_local_url(
'editapplication',
array(
'nickname' => $this->owner->nickname,
'id' => $this->application->id
)
)
), 'Edit');
array('href' => common_local_url('editapplication',
array('id' => $this->application->id))),
'Edit');
$this->elementEnd('li');
$this->elementStart('li', 'entity_reset_keysecret');
@ -228,8 +222,7 @@ class ShowApplicationAction extends OwnerDesignAction
'class' => 'form_reset_key',
'method' => 'POST',
'action' => common_local_url('showapplication',
array('nickname' => $cur->nickname,
'id' => $this->application->id))));
array('id' => $this->application->id))));
$this->elementStart('fieldset');
$this->hidden('token', common_session_token());
@ -273,12 +266,8 @@ class ShowApplicationAction extends OwnerDesignAction
$this->elementStart('p', array('id' => 'application_action'));
$this->element('a',
array(
'href' => common_local_url(
'apps',
array('nickname' => $this->owner->nickname)),
'class' => 'more'
),
array('href' => common_local_url('oauthappssettings'),
'class' => 'more'),
'View your applications');
$this->elementEnd('p');
}

View File

@ -119,12 +119,9 @@ class ApplicationEditForm extends Form
if (!empty($this->application)) {
return common_local_url('editapplication',
array('id' => $this->application->id,
'nickname' => $cur->nickname)
);
array('id' => $this->application->id));
} else {
return common_local_url('newapplication',
array('nickname' => $cur->nickname));
return common_local_url('newapplication');
}
}

View File

@ -98,8 +98,7 @@ class ApplicationList extends Widget
if (!$this->connections) {
$this->out->elementStart('a',
array('href' => common_local_url('showapplication',
array('nickname' => $user->nickname,
'id' => $this->application->id)),
array('id' => $this->application->id)),
'class' => 'url'));
} else {
@ -154,8 +153,4 @@ class ApplicationList extends Widget
return;
}
function highlight($text)
{
return htmlspecialchars($text);
}
}

View File

@ -141,7 +141,7 @@ class Router
// settings
foreach (array('profile', 'avatar', 'password', 'im', 'oauthconnections',
'email', 'sms', 'userdesign', 'other') as $s) {
'oauthapps', 'email', 'sms', 'userdesign', 'other') as $s) {
$m->connect('settings/'.$s, array('action' => $s.'settings'));
}
@ -634,28 +634,23 @@ class Router
// user stuff
foreach (array('subscriptions', 'subscribers',
'nudge', 'all', 'foaf', 'xrds', 'apps',
'nudge', 'all', 'foaf', 'xrds',
'replies', 'inbox', 'outbox', 'microsummary') as $a) {
$m->connect(':nickname/'.$a,
array('action' => $a),
array('nickname' => '[a-zA-Z0-9]{1,64}'));
}
$m->connect(':nickname/apps',
array('action' => 'apps'),
array('nickname' => '['.NICKNAME_FMT.']{1,64}'));
$m->connect(':nickname/apps/show/:id',
$m->connect('settings/oauthapps/show/:id',
array('action' => 'showapplication'),
array('nickname' => '['.NICKNAME_FMT.']{1,64}',
'id' => '[0-9]+')
array('id' => '[0-9]+')
);
$m->connect(':nickname/apps/new',
array('action' => 'newapplication'),
array('nickname' => '['.NICKNAME_FMT.']{1,64}'));
$m->connect(':nickname/apps/edit/:id',
$m->connect('settings/oauthapps/new',
array('action' => 'newapplication')
);
$m->connect('settings/oauthapps/edit/:id',
array('action' => 'editapplication'),
array('nickname' => '['.NICKNAME_FMT.']{1,64}',
'id' => '[0-9]+')
array('id' => '[0-9]+')
);
$m->connect('api/oauth/request_token',