let admins prevent registration

darcs-hash:20080724235508-84dde-8bac4d9dd772adb9f27d083b3d0b6ed5b7526dbf.gz
This commit is contained in:
Evan Prodromou 2008-07-24 19:55:08 -04:00
parent 3a262a3bcd
commit e97c06e8e2
3 changed files with 8 additions and 2 deletions

View File

@ -24,7 +24,9 @@ class RegisterAction extends Action {
function handle($args) { function handle($args) {
parent::handle($args); parent::handle($args);
if (common_logged_in()) { if (common_config('site', 'closed')) {
common_user_error(_('Registration not allowed.'));
} else if (common_logged_in()) {
common_user_error(_('Already logged in.')); common_user_error(_('Already logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') { } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->try_register(); $this->try_register();

View File

@ -23,6 +23,9 @@ $config['site']['path'] = 'laconica';
#Brought by... #Brought by...
#$config['site']['broughtby'] = 'Individual or Company'; #$config['site']['broughtby'] = 'Individual or Company';
#$config['site']['broughtbyurl'] = 'http://example.net/'; #$config['site']['broughtbyurl'] = 'http://example.net/';
#If you don't want to let users register (say, for a one-person install)
#Crude but effective -- register everybody, then lock down
#$config['site']['closed'] = true;
# If you want logging sent to a file instead of syslog # If you want logging sent to a file instead of syslog
#$config['site']['logfile'] = '/tmp/laconica.log'; #$config['site']['logfile'] = '/tmp/laconica.log';

View File

@ -50,7 +50,8 @@ $config =
array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : NULL, array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : NULL,
'broughtby' => NULL, 'broughtby' => NULL,
'timezone' => 'UTC', 'timezone' => 'UTC',
'broughtbyurl' => NULL), 'broughtbyurl' => NULL,
'closed' => false),
'syslog' => 'syslog' =>
array('appname' => 'laconica', # for syslog array('appname' => 'laconica', # for syslog
'priority' => 'debug'), # XXX: currently ignored 'priority' => 'debug'), # XXX: currently ignored