forked from GNUsocial/gnu-social
Pretty up the OpenID variant of the OAuth login form a bit; change the 'Allow' button to 'Continue' so we're not confused why we get the form again after authenticating.
This commit is contained in:
parent
bcc06d05e8
commit
c24f4ddfdb
@ -347,8 +347,10 @@ class ApiOauthAuthorizeAction extends Action
|
|||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
|
|
||||||
|
// quickie hack
|
||||||
|
$button = false;
|
||||||
if (!common_logged_in()) {
|
if (!common_logged_in()) {
|
||||||
if (Event::handle('StartOAuthLoginForm', array($this))) {
|
if (Event::handle('StartOAuthLoginForm', array($this, &$button))) {
|
||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
// TRANS: Fieldset legend.
|
// TRANS: Fieldset legend.
|
||||||
$this->element('legend', null, _m('LEGEND','Account'));
|
$this->element('legend', null, _m('LEGEND','Account'));
|
||||||
@ -365,7 +367,7 @@ class ApiOauthAuthorizeAction extends Action
|
|||||||
|
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
}
|
}
|
||||||
Event::handle('EndOAuthLoginForm', array($this));
|
Event::handle('EndOAuthLoginForm', array($this, &$button));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->element('input', array('id' => 'cancel_submit',
|
$this->element('input', array('id' => 'cancel_submit',
|
||||||
@ -381,7 +383,7 @@ class ApiOauthAuthorizeAction extends Action
|
|||||||
'name' => 'allow',
|
'name' => 'allow',
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
// TRANS: Button text that when clicked will allow access to an account by an external application.
|
// TRANS: Button text that when clicked will allow access to an account by an external application.
|
||||||
'value' => _m('BUTTON','Allow')));
|
'value' => $button ? $button : _m('BUTTON','Allow')));
|
||||||
|
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
|
@ -655,11 +655,13 @@ class OpenIDPlugin extends Plugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onStartOAuthLoginForm($action)
|
function onStartOAuthLoginForm($action, &$button)
|
||||||
{
|
{
|
||||||
if (common_config('site', 'openidonly')) {
|
if (common_config('site', 'openidonly')) {
|
||||||
// Cancel the regular password login form, we won't need it.
|
// Cancel the regular password login form, we won't need it.
|
||||||
$this->showOAuthLoginForm($action);
|
$this->showOAuthLoginForm($action);
|
||||||
|
// TRANS: button label for OAuth authorization page when needing OpenID authentication first.
|
||||||
|
$button = _m('BUTTON', 'Continue');
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// Leave the regular password login form in place.
|
// Leave the regular password login form in place.
|
||||||
@ -674,6 +676,10 @@ class OpenIDPlugin extends Plugin
|
|||||||
*/
|
*/
|
||||||
protected function showOAuthLoginForm($action)
|
protected function showOAuthLoginForm($action)
|
||||||
{
|
{
|
||||||
|
$action->elementStart('fieldset');
|
||||||
|
// TRANS: OpenID plugin logon form legend.
|
||||||
|
$action->element('legend', null, _m('OpenID login'));
|
||||||
|
|
||||||
$action->elementStart('ul', 'form_data');
|
$action->elementStart('ul', 'form_data');
|
||||||
$action->elementStart('li');
|
$action->elementStart('li');
|
||||||
$provider = common_config('openid', 'trusted_provider');
|
$provider = common_config('openid', 'trusted_provider');
|
||||||
@ -699,6 +705,8 @@ class OpenIDPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
$action->elementEnd('li');
|
$action->elementEnd('li');
|
||||||
$action->elementEnd('ul');
|
$action->elementEnd('ul');
|
||||||
|
|
||||||
|
$action->elementEnd('fieldset');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user