]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/register.php
add Net Socket
[quix0rs-gnu-social.git] / actions / register.php
index c370e47276cf4db292149f061261df76a171a2bb..1d7e71dfbc86138fefec984ec6c8af4afb9b53dd 100644 (file)
@@ -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, only invited people can register.'));
+                       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, only invited people can register.'));
+                       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);
                }