summaryrefslogtreecommitdiff
path: root/actions/register.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2008-10-21 14:28:22 -0400
committerEvan Prodromou <evan@controlyourself.ca>2008-10-21 14:28:22 -0400
commit3a246c17266d562e0510e5a332009dcfda43c1c7 (patch)
tree6cf8b24dc7d28c498e1c618bd6e514a974863d90 /actions/register.php
parent44a90a7fa78d8b40485fd36020c333271a0b5734 (diff)
add 'invite-only' mode for registration
darcs-hash:20081021182822-5ed1f-9a8ee3960f82d115d43e35baac646f69bc702533.gz
Diffstat (limited to 'actions/register.php')
-rw-r--r--actions/register.php24
1 files changed, 21 insertions, 3 deletions
diff --git a/actions/register.php b/actions/register.php
index c370e4727..10336d41e 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -59,6 +59,15 @@ class RegisterAction extends Action {
$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);
@@ -149,6 +158,17 @@ class RegisterAction extends Action {
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',
@@ -156,9 +176,7 @@ class RegisterAction extends Action {
common_hidden('token', common_session_token());
- if ($this->trimmed('code')) {
- $code = ($this->trimmed('code'));
- $invite = Invitation::staticGet($code);
+ if ($code) {
common_hidden('code', $code);
}