Rework application registration workflow to be more private
This commit is contained in:
parent
22809baf94
commit
7c34ac8cc2
|
@ -125,10 +125,7 @@ class EditApplicationAction extends OwnerDesignAction
|
||||||
|
|
||||||
if ($this->arg('cancel')) {
|
if ($this->arg('cancel')) {
|
||||||
common_redirect(common_local_url('showapplication',
|
common_redirect(common_local_url('showapplication',
|
||||||
array(
|
array('id' => $this->app->id)), 303);
|
||||||
'nickname' => $cur->nickname,
|
|
||||||
'id' => $this->app->id)
|
|
||||||
), 303);
|
|
||||||
} elseif ($this->arg('save')) {
|
} elseif ($this->arg('save')) {
|
||||||
$this->trySave();
|
$this->trySave();
|
||||||
} else {
|
} else {
|
||||||
|
@ -253,8 +250,7 @@ class EditApplicationAction extends OwnerDesignAction
|
||||||
|
|
||||||
$this->app->uploadLogo();
|
$this->app->uploadLogo();
|
||||||
|
|
||||||
common_redirect(common_local_url('apps',
|
common_redirect(common_local_url('oauthappssettings'), 303);
|
||||||
array('nickname' => $cur->nickname)), 303);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,8 +114,7 @@ class NewApplicationAction extends OwnerDesignAction
|
||||||
$cur = common_current_user();
|
$cur = common_current_user();
|
||||||
|
|
||||||
if ($this->arg('cancel')) {
|
if ($this->arg('cancel')) {
|
||||||
common_redirect(common_local_url('apps',
|
common_redirect(common_local_url('oauthappssettings'), 303);
|
||||||
array('nickname' => $cur->nickname)), 303);
|
|
||||||
} elseif ($this->arg('save')) {
|
} elseif ($this->arg('save')) {
|
||||||
$this->trySave();
|
$this->trySave();
|
||||||
} else {
|
} else {
|
||||||
|
@ -147,7 +146,7 @@ class NewApplicationAction extends OwnerDesignAction
|
||||||
|
|
||||||
function trySave()
|
function trySave()
|
||||||
{
|
{
|
||||||
$name = $this->trimmed('name');
|
$name = $this->trimmed('name');
|
||||||
$description = $this->trimmed('description');
|
$description = $this->trimmed('description');
|
||||||
$source_url = $this->trimmed('source_url');
|
$source_url = $this->trimmed('source_url');
|
||||||
$organization = $this->trimmed('organization');
|
$organization = $this->trimmed('organization');
|
||||||
|
@ -270,8 +269,7 @@ class NewApplicationAction extends OwnerDesignAction
|
||||||
|
|
||||||
$app->query('COMMIT');
|
$app->query('COMMIT');
|
||||||
|
|
||||||
common_redirect(common_local_url('apps',
|
common_redirect(common_local_url('oauthappssettings'), 303);
|
||||||
array('nickname' => $cur->nickname)), 303);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ require_once INSTALLDIR . '/lib/applicationlist.php';
|
||||||
* @see SettingsAction
|
* @see SettingsAction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AppsAction extends SettingsAction
|
class OauthappssettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
var $page = 0;
|
var $page = 0;
|
||||||
|
|
||||||
|
@ -116,10 +116,7 @@ class AppsAction extends SettingsAction
|
||||||
|
|
||||||
$this->elementStart('p', array('id' => 'application_register'));
|
$this->elementStart('p', array('id' => 'application_register'));
|
||||||
$this->element('a',
|
$this->element('a',
|
||||||
array('href' => common_local_url(
|
array('href' => common_local_url('newapplication'),
|
||||||
'newapplication',
|
|
||||||
array('nickname' => $user->nickname)
|
|
||||||
),
|
|
||||||
'class' => 'more'
|
'class' => 'more'
|
||||||
),
|
),
|
||||||
'Register a new application');
|
'Register a new application');
|
||||||
|
@ -129,8 +126,7 @@ class AppsAction extends SettingsAction
|
||||||
$this->page > 1,
|
$this->page > 1,
|
||||||
$cnt > APPS_PER_PAGE,
|
$cnt > APPS_PER_PAGE,
|
||||||
$this->page,
|
$this->page,
|
||||||
'apps',
|
'oauthappssettings'
|
||||||
array('nickname' => $user->nickname)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
|
||||||
$this->elementStart('p');
|
$this->elementStart('p');
|
||||||
$this->raw(_('Developers can edit the registration settings for their applications '));
|
$this->raw(_('Developers can edit the registration settings for their applications '));
|
||||||
$this->element('a',
|
$this->element('a',
|
||||||
array('href' => common_local_url('apps', array('nickname' => $cur->nickname))),
|
array('href' => common_local_url('oauthappssettings')),
|
||||||
'here.');
|
'here.');
|
||||||
$this->elementEnd('p');
|
$this->elementEnd('p');
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,15 +211,9 @@ class ShowApplicationAction extends OwnerDesignAction
|
||||||
$this->elementStart('ul');
|
$this->elementStart('ul');
|
||||||
$this->elementStart('li', 'entity_edit');
|
$this->elementStart('li', 'entity_edit');
|
||||||
$this->element('a',
|
$this->element('a',
|
||||||
array('href' =>
|
array('href' => common_local_url('editapplication',
|
||||||
common_local_url(
|
array('id' => $this->application->id))),
|
||||||
'editapplication',
|
'Edit');
|
||||||
array(
|
|
||||||
'nickname' => $this->owner->nickname,
|
|
||||||
'id' => $this->application->id
|
|
||||||
)
|
|
||||||
)
|
|
||||||
), 'Edit');
|
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
|
||||||
$this->elementStart('li', 'entity_reset_keysecret');
|
$this->elementStart('li', 'entity_reset_keysecret');
|
||||||
|
@ -228,8 +222,7 @@ class ShowApplicationAction extends OwnerDesignAction
|
||||||
'class' => 'form_reset_key',
|
'class' => 'form_reset_key',
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'action' => common_local_url('showapplication',
|
'action' => common_local_url('showapplication',
|
||||||
array('nickname' => $cur->nickname,
|
array('id' => $this->application->id))));
|
||||||
'id' => $this->application->id))));
|
|
||||||
|
|
||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
$this->hidden('token', common_session_token());
|
$this->hidden('token', common_session_token());
|
||||||
|
@ -273,13 +266,9 @@ class ShowApplicationAction extends OwnerDesignAction
|
||||||
|
|
||||||
$this->elementStart('p', array('id' => 'application_action'));
|
$this->elementStart('p', array('id' => 'application_action'));
|
||||||
$this->element('a',
|
$this->element('a',
|
||||||
array(
|
array('href' => common_local_url('oauthappssettings'),
|
||||||
'href' => common_local_url(
|
'class' => 'more'),
|
||||||
'apps',
|
'View your applications');
|
||||||
array('nickname' => $this->owner->nickname)),
|
|
||||||
'class' => 'more'
|
|
||||||
),
|
|
||||||
'View your applications');
|
|
||||||
$this->elementEnd('p');
|
$this->elementEnd('p');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,12 +119,9 @@ class ApplicationEditForm extends Form
|
||||||
|
|
||||||
if (!empty($this->application)) {
|
if (!empty($this->application)) {
|
||||||
return common_local_url('editapplication',
|
return common_local_url('editapplication',
|
||||||
array('id' => $this->application->id,
|
array('id' => $this->application->id));
|
||||||
'nickname' => $cur->nickname)
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
return common_local_url('newapplication',
|
return common_local_url('newapplication');
|
||||||
array('nickname' => $cur->nickname));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +146,7 @@ class ApplicationEditForm extends Form
|
||||||
{
|
{
|
||||||
if ($this->application) {
|
if ($this->application) {
|
||||||
$id = $this->application->id;
|
$id = $this->application->id;
|
||||||
$icon = $this->application->icon;
|
$icon = $this->application->icon;
|
||||||
$name = $this->application->name;
|
$name = $this->application->name;
|
||||||
$description = $this->application->description;
|
$description = $this->application->description;
|
||||||
$source_url = $this->application->source_url;
|
$source_url = $this->application->source_url;
|
||||||
|
@ -160,7 +157,7 @@ class ApplicationEditForm extends Form
|
||||||
$this->access_type = $this->application->access_type;
|
$this->access_type = $this->application->access_type;
|
||||||
} else {
|
} else {
|
||||||
$id = '';
|
$id = '';
|
||||||
$icon = '';
|
$icon = '';
|
||||||
$name = '';
|
$name = '';
|
||||||
$description = '';
|
$description = '';
|
||||||
$source_url = '';
|
$source_url = '';
|
||||||
|
@ -171,26 +168,26 @@ class ApplicationEditForm extends Form
|
||||||
$this->access_type = '';
|
$this->access_type = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out->hidden('token', common_session_token());
|
$this->out->hidden('token', common_session_token());
|
||||||
|
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
$this->out->elementStart('li', array('id' => 'application_icon'));
|
$this->out->elementStart('li', array('id' => 'application_icon'));
|
||||||
|
|
||||||
if (!empty($icon)) {
|
if (!empty($icon)) {
|
||||||
$this->out->element('img', array('src' => $icon));
|
$this->out->element('img', array('src' => $icon));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out->element('label', array('for' => 'app_icon'),
|
$this->out->element('label', array('for' => 'app_icon'),
|
||||||
_('Icon'));
|
_('Icon'));
|
||||||
$this->out->element('input', array('name' => 'app_icon',
|
$this->out->element('input', array('name' => 'app_icon',
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'id' => 'app_icon'));
|
'id' => 'app_icon'));
|
||||||
$this->out->element('p', 'form_guide', _('Icon for this application'));
|
$this->out->element('p', 'form_guide', _('Icon for this application'));
|
||||||
$this->out->element('input', array('name' => 'MAX_FILE_SIZE',
|
$this->out->element('input', array('name' => 'MAX_FILE_SIZE',
|
||||||
'type' => 'hidden',
|
'type' => 'hidden',
|
||||||
'id' => 'MAX_FILE_SIZE',
|
'id' => 'MAX_FILE_SIZE',
|
||||||
'value' => ImageFile::maxFileSizeInt()));
|
'value' => ImageFile::maxFileSizeInt()));
|
||||||
$this->out->elementEnd('li');
|
$this->out->elementEnd('li');
|
||||||
|
|
||||||
$this->out->elementStart('li');
|
$this->out->elementStart('li');
|
||||||
|
@ -207,13 +204,13 @@ class ApplicationEditForm extends Form
|
||||||
$maxDesc = Oauth_application::maxDesc();
|
$maxDesc = Oauth_application::maxDesc();
|
||||||
if ($maxDesc > 0) {
|
if ($maxDesc > 0) {
|
||||||
$descInstr = sprintf(_('Describe your application in %d chars'),
|
$descInstr = sprintf(_('Describe your application in %d chars'),
|
||||||
$maxDesc);
|
$maxDesc);
|
||||||
} else {
|
} else {
|
||||||
$descInstr = _('Describe your application');
|
$descInstr = _('Describe your application');
|
||||||
}
|
}
|
||||||
$this->out->textarea('description', _('Description'),
|
$this->out->textarea('description', _('Description'),
|
||||||
($this->out->arg('description')) ? $this->out->arg('description') : $description,
|
($this->out->arg('description')) ? $this->out->arg('description') : $description,
|
||||||
$descInstr);
|
$descInstr);
|
||||||
|
|
||||||
$this->out->elementEnd('li');
|
$this->out->elementEnd('li');
|
||||||
|
|
||||||
|
@ -259,8 +256,8 @@ class ApplicationEditForm extends Form
|
||||||
$this->out->element('input', $attrs);
|
$this->out->element('input', $attrs);
|
||||||
|
|
||||||
$this->out->element('label', array('for' => 'app_type-browser',
|
$this->out->element('label', array('for' => 'app_type-browser',
|
||||||
'class' => 'radio'),
|
'class' => 'radio'),
|
||||||
_('Browser'));
|
_('Browser'));
|
||||||
|
|
||||||
$attrs = array('name' => 'app_type',
|
$attrs = array('name' => 'app_type',
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
|
@ -275,8 +272,8 @@ class ApplicationEditForm extends Form
|
||||||
$this->out->element('input', $attrs);
|
$this->out->element('input', $attrs);
|
||||||
|
|
||||||
$this->out->element('label', array('for' => 'app_type-desktop',
|
$this->out->element('label', array('for' => 'app_type-desktop',
|
||||||
'class' => 'radio'),
|
'class' => 'radio'),
|
||||||
_('Desktop'));
|
_('Desktop'));
|
||||||
$this->out->element('p', 'form_guide', _('Type of application, browser or desktop'));
|
$this->out->element('p', 'form_guide', _('Type of application, browser or desktop'));
|
||||||
$this->out->elementEnd('li');
|
$this->out->elementEnd('li');
|
||||||
|
|
||||||
|
@ -298,8 +295,8 @@ class ApplicationEditForm extends Form
|
||||||
$this->out->element('input', $attrs);
|
$this->out->element('input', $attrs);
|
||||||
|
|
||||||
$this->out->element('label', array('for' => 'default_access_type-ro',
|
$this->out->element('label', array('for' => 'default_access_type-ro',
|
||||||
'class' => 'radio'),
|
'class' => 'radio'),
|
||||||
_('Read-only'));
|
_('Read-only'));
|
||||||
|
|
||||||
$attrs = array('name' => 'default_access_type',
|
$attrs = array('name' => 'default_access_type',
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
|
@ -309,15 +306,15 @@ class ApplicationEditForm extends Form
|
||||||
|
|
||||||
if ($this->application->access_type & Oauth_application::$readAccess
|
if ($this->application->access_type & Oauth_application::$readAccess
|
||||||
&& $this->application->access_type & Oauth_application::$writeAccess
|
&& $this->application->access_type & Oauth_application::$writeAccess
|
||||||
) {
|
) {
|
||||||
$attrs['checked'] = 'checked';
|
$attrs['checked'] = 'checked';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out->element('input', $attrs);
|
$this->out->element('input', $attrs);
|
||||||
|
|
||||||
$this->out->element('label', array('for' => 'default_access_type-rw',
|
$this->out->element('label', array('for' => 'default_access_type-rw',
|
||||||
'class' => 'radio'),
|
'class' => 'radio'),
|
||||||
_('Read-write'));
|
_('Read-write'));
|
||||||
$this->out->element('p', 'form_guide', _('Default access for this application: read-only, or read-write'));
|
$this->out->element('p', 'form_guide', _('Default access for this application: read-only, or read-write'));
|
||||||
|
|
||||||
$this->out->elementEnd('li');
|
$this->out->elementEnd('li');
|
||||||
|
@ -334,8 +331,8 @@ class ApplicationEditForm extends Form
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('cancel', _('Cancel'), 'submit form_action-primary',
|
$this->out->submit('cancel', _('Cancel'), 'submit form_action-primary',
|
||||||
'cancel', _('Cancel'));
|
'cancel', _('Cancel'));
|
||||||
$this->out->submit('save', _('Save'), 'submit form_action-secondary',
|
$this->out->submit('save', _('Save'), 'submit form_action-secondary',
|
||||||
'save', _('Save'));
|
'save', _('Save'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ class ApplicationList extends Widget
|
||||||
$this->application = $application;
|
$this->application = $application;
|
||||||
$this->owner = $owner;
|
$this->owner = $owner;
|
||||||
$this->action = $action;
|
$this->action = $action;
|
||||||
$this->connections = $connections;
|
$this->connections = $connections;
|
||||||
}
|
}
|
||||||
|
|
||||||
function show()
|
function show()
|
||||||
|
@ -97,10 +97,9 @@ class ApplicationList extends Widget
|
||||||
$this->out->elementStart('span', 'vcard author');
|
$this->out->elementStart('span', 'vcard author');
|
||||||
if (!$this->connections) {
|
if (!$this->connections) {
|
||||||
$this->out->elementStart('a',
|
$this->out->elementStart('a',
|
||||||
array('href' => common_local_url('showapplication',
|
array('href' => common_local_url('showapplication',
|
||||||
array('nickname' => $user->nickname,
|
array('id' => $this->application->id)),
|
||||||
'id' => $this->application->id)),
|
'class' => 'url'));
|
||||||
'class' => 'url'));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->out->elementStart('a', array('href' => $this->application->source_url,
|
$this->out->elementStart('a', array('href' => $this->application->source_url,
|
||||||
|
@ -154,8 +153,4 @@ class ApplicationList extends Widget
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function highlight($text)
|
|
||||||
{
|
|
||||||
return htmlspecialchars($text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ class Router
|
||||||
// settings
|
// settings
|
||||||
|
|
||||||
foreach (array('profile', 'avatar', 'password', 'im', 'oauthconnections',
|
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'));
|
$m->connect('settings/'.$s, array('action' => $s.'settings'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,28 +634,23 @@ class Router
|
||||||
// user stuff
|
// user stuff
|
||||||
|
|
||||||
foreach (array('subscriptions', 'subscribers',
|
foreach (array('subscriptions', 'subscribers',
|
||||||
'nudge', 'all', 'foaf', 'xrds', 'apps',
|
'nudge', 'all', 'foaf', 'xrds',
|
||||||
'replies', 'inbox', 'outbox', 'microsummary') as $a) {
|
'replies', 'inbox', 'outbox', 'microsummary') as $a) {
|
||||||
$m->connect(':nickname/'.$a,
|
$m->connect(':nickname/'.$a,
|
||||||
array('action' => $a),
|
array('action' => $a),
|
||||||
array('nickname' => '[a-zA-Z0-9]{1,64}'));
|
array('nickname' => '[a-zA-Z0-9]{1,64}'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$m->connect(':nickname/apps',
|
$m->connect('settings/oauthapps/show/:id',
|
||||||
array('action' => 'apps'),
|
|
||||||
array('nickname' => '['.NICKNAME_FMT.']{1,64}'));
|
|
||||||
$m->connect(':nickname/apps/show/:id',
|
|
||||||
array('action' => 'showapplication'),
|
array('action' => 'showapplication'),
|
||||||
array('nickname' => '['.NICKNAME_FMT.']{1,64}',
|
array('id' => '[0-9]+')
|
||||||
'id' => '[0-9]+')
|
|
||||||
);
|
);
|
||||||
$m->connect(':nickname/apps/new',
|
$m->connect('settings/oauthapps/new',
|
||||||
array('action' => 'newapplication'),
|
array('action' => 'newapplication')
|
||||||
array('nickname' => '['.NICKNAME_FMT.']{1,64}'));
|
);
|
||||||
$m->connect(':nickname/apps/edit/:id',
|
$m->connect('settings/oauthapps/edit/:id',
|
||||||
array('action' => 'editapplication'),
|
array('action' => 'editapplication'),
|
||||||
array('nickname' => '['.NICKNAME_FMT.']{1,64}',
|
array('id' => '[0-9]+')
|
||||||
'id' => '[0-9]+')
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$m->connect('api/oauth/request_token',
|
$m->connect('api/oauth/request_token',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user