]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Make EmailRegistration respect registration flags
authorEvan Prodromou <evan@status.net>
Tue, 3 May 2011 02:12:29 +0000 (19:12 -0700)
committerEvan Prodromou <evan@status.net>
Tue, 3 May 2011 02:12:29 +0000 (19:12 -0700)
The email registration code wasn't respecting site-closed or
site-inviteonly flags. This is fixed.

plugins/EmailRegistration/emailregister.php

index 2d32b40456e891225878696012e76330e51645a3..2e69758e842fc2d20f0a16599592c06713865eaf 100644 (file)
@@ -79,6 +79,10 @@ class EmailregisterAction extends Action
     {
         parent::prepare($argarray);
 
+        if (common_config('site', 'closed')) {
+            throw new ClientException(_('Registration not allowed.'), 403);
+        }
+
         if ($this->isPost()) {
 
             $this->checkSessionToken();
@@ -86,6 +90,9 @@ class EmailregisterAction extends Action
             $this->email = $this->trimmed('email');
 
             if (!empty($this->email)) {
+                if (common_config('site', 'inviteonly')) {
+                    throw new ClientException(_('Sorry, only invited people can register.'), 403);
+                }
                 $this->email = common_canonical_email($this->email);
                 $this->state = self::NEWEMAIL;
             } else {
@@ -119,6 +126,9 @@ class EmailregisterAction extends Action
             $this->code = $this->trimmed('code');
 
             if (empty($this->code)) {
+                if (common_config('site', 'inviteonly')) {
+                    throw new ClientException(_('Sorry, only invited people can register.'), 403);
+                }
                 $this->state = self::NEWREGISTER;
             } else {
                 $this->invitation = Invitation::staticGet('code', $this->code);