X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fregister.php;h=1d7e71dfbc86138fefec984ec6c8af4afb9b53dd;hb=4f3d1e93e97365deac2366bfe422e8301d773a25;hp=c370e47276cf4db292149f061261df76a171a2bb;hpb=ce2eaf84aac790a647cda202d6e361ffb1fdff3b;p=quix0rs-gnu-social.git diff --git a/actions/register.php b/actions/register.php index c370e47276..1d7e71dfbc 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, 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); }