Merge commit 'jeff-themovie/0.8.x-openid-enabled' into 0.8.x
This commit is contained in:
commit
136a69a387
8
README
8
README
|
@ -1169,6 +1169,14 @@ For configuring invites.
|
|||
|
||||
enabled: Whether to allow users to send invites. Default true.
|
||||
|
||||
openid
|
||||
------
|
||||
|
||||
For configuring OpenID.
|
||||
|
||||
enabled: Whether to allow users to register and login using OpenID. Default
|
||||
true.
|
||||
|
||||
tag
|
||||
---
|
||||
|
||||
|
|
|
@ -30,7 +30,9 @@ class FinishopenidloginAction extends Action
|
|||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
if (common_is_real_login()) {
|
||||
if (!common_config('openid', 'enabled')) {
|
||||
common_redirect(common_local_url('login'));
|
||||
} else if (common_is_real_login()) {
|
||||
$this->clientError(_('Already logged in.'));
|
||||
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$token = $this->trimmed('token');
|
||||
|
|
|
@ -251,11 +251,15 @@ class LoginAction extends Action
|
|||
return _('For security reasons, please re-enter your ' .
|
||||
'user name and password ' .
|
||||
'before changing your settings.');
|
||||
} else {
|
||||
} else if (common_config('openid', 'enabled')) {
|
||||
return _('Login with your username and password. ' .
|
||||
'Don\'t have a username yet? ' .
|
||||
'[Register](%%action.register%%) a new account, or ' .
|
||||
'try [OpenID](%%action.openidlogin%%). ');
|
||||
} else {
|
||||
return _('Login with your username and password. ' .
|
||||
'Don\'t have a username yet? ' .
|
||||
'[Register](%%action.register%%) a new account.');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,9 @@ class OpenidloginAction extends Action
|
|||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
if (common_is_real_login()) {
|
||||
if (!common_config('openid', 'enabled')) {
|
||||
common_redirect(common_local_url('login'));
|
||||
} else if (common_is_real_login()) {
|
||||
$this->clientError(_('Already logged in.'));
|
||||
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$openid_url = $this->trimmed('openid_url');
|
||||
|
|
|
@ -82,6 +82,12 @@ class OpenidsettingsAction extends AccountSettingsAction
|
|||
|
||||
function showContent()
|
||||
{
|
||||
if (!common_config('openid', 'enabled')) {
|
||||
$this->element('div', array('class' => 'error'),
|
||||
_('OpenID is not available.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$user = common_current_user();
|
||||
|
||||
$this->elementStart('form', array('method' => 'post',
|
||||
|
|
|
@ -329,6 +329,7 @@ class RegisterAction extends Action
|
|||
} else if ($this->error) {
|
||||
$this->element('p', 'error', $this->error);
|
||||
} else {
|
||||
if (common_config('openid', 'enabled')) {
|
||||
$instr =
|
||||
common_markup_to_html(_('With this form you can create '.
|
||||
' a new account. ' .
|
||||
|
@ -337,6 +338,13 @@ class RegisterAction extends Action
|
|||
'(Have an [OpenID](http://openid.net/)? ' .
|
||||
'Try our [OpenID registration]'.
|
||||
'(%%action.openidlogin%%)!)'));
|
||||
} else {
|
||||
$instr =
|
||||
common_markup_to_html(_('With this form you can create '.
|
||||
' a new account. ' .
|
||||
'You can then post notices and '.
|
||||
'link up to friends and colleagues.'));
|
||||
}
|
||||
|
||||
$this->elementStart('div', 'instructions');
|
||||
$this->raw($instr);
|
||||
|
|
|
@ -99,6 +99,9 @@ $config['sphinx']['port'] = 3312;
|
|||
// $config['xmpp']['public'][] = 'someindexer@example.net';
|
||||
// $config['xmpp']['debug'] = false;
|
||||
|
||||
// Disable OpenID
|
||||
// $config['openid']['enabled'] = false;
|
||||
|
||||
// Turn off invites
|
||||
// $config['invite']['enabled'] = false;
|
||||
|
||||
|
|
|
@ -126,6 +126,10 @@ class AccountSettingsNav extends Widget
|
|||
$this->action->elementStart('ul', array('class' => 'nav'));
|
||||
|
||||
foreach ($menu as $menuaction => $menudesc) {
|
||||
if ($menuaction == 'openidsettings' &&
|
||||
!common_config('openid', 'enabled')) {
|
||||
continue;
|
||||
}
|
||||
$this->action->menuItem(common_local_url($menuaction),
|
||||
$menudesc[0],
|
||||
$menudesc[1],
|
||||
|
|
|
@ -170,6 +170,8 @@ $config =
|
|||
'host' => null, # only set if != server
|
||||
'debug' => false, # print extra debug info
|
||||
'public' => array()), # JIDs of users who want to receive the public stream
|
||||
'openid' =>
|
||||
array('enabled' => true),
|
||||
'invite' =>
|
||||
array('enabled' => true),
|
||||
'sphinx' =>
|
||||
|
@ -371,6 +373,12 @@ if ($_db_name != 'laconica' && !array_key_exists('ini_'.$_db_name, $config['db']
|
|||
$config['db']['ini_'.$_db_name] = INSTALLDIR.'/classes/laconica.ini';
|
||||
}
|
||||
|
||||
// Ignore openidonly if OpenID is disabled
|
||||
|
||||
if (!$config['openid']['enabled']) {
|
||||
$config['site']['openidonly'] = false;
|
||||
}
|
||||
|
||||
// XXX: how many of these could be auto-loaded on use?
|
||||
|
||||
require_once 'Validate.php';
|
||||
|
|
|
@ -80,8 +80,10 @@ class LoginGroupNav extends Widget
|
|||
_('Sign up for a new account'));
|
||||
}
|
||||
}
|
||||
if (common_config('openid', 'enabled')) {
|
||||
$menu['openidlogin'] = array(_('OpenID'),
|
||||
_('Login or register with OpenID'));
|
||||
}
|
||||
|
||||
$action_name = $this->action->trimmed('action');
|
||||
$this->action->elementStart('ul', array('class' => 'nav'));
|
||||
|
|
Loading…
Reference in New Issue
Block a user