This is a cheap way to restrict accounts to only one
individual or group; just register the accounts you want on
the service, *then* set this variable to 'true'.
+inviteonly: If set to 'true', will only allow registration if the user
+ was invited by an existing user.
db
--
$code = $this->trimmed('code');
+ if ($code) {
+ $invite = Invitation::staticGet($code);
+ }
+
+ if (common_config('site', 'inviteonly') && !($code && $invite)) {
+ $this->client_error(_('Sorry, site is invite-only'));
+ return;
+ }
+
# Input scrubbing
$nickname = common_canonical_nickname($nickname);
function show_form($error=NULL) {
global $config;
+ $code = $this->trimmed('code');
+
+ if ($code) {
+ $invite = Invitation::staticGet($code);
+ }
+
+ if (common_config('site', 'inviteonly') && !($code && $invite)) {
+ $this->client_error(_('Sorry, site is invite-only'));
+ return;
+ }
+
common_show_header(_('Register'), NULL, $error, array($this, 'show_top'));
common_element_start('form', array('method' => 'post',
'id' => 'login',
common_hidden('token', common_session_token());
- if ($this->trimmed('code')) {
- $code = ($this->trimmed('code'));
- $invite = Invitation::staticGet($code);
+ if ($code) {
common_hidden('code', $code);
}
#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;
+#Only allow registration for people invited by another user
+#$config['site']['inviteonly'] = true;
# If you want logging sent to a file instead of syslog
#$config['site']['logfile'] = '/tmp/laconica.log';
'broughtby' => NULL,
'timezone' => 'UTC',
'broughtbyurl' => NULL,
- 'closed' => false),
+ 'closed' => false,
+ 'inviteonly' => false),
'syslog' =>
array('appname' => 'laconica', # for syslog
'priority' => 'debug'), # XXX: currently ignored