From: Evan Prodromou Date: Tue, 3 May 2011 02:12:29 +0000 (-0700) Subject: Make EmailRegistration respect registration flags X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=784da5d2319e51f7236874025ef4b55a76a79db8;p=quix0rs-gnu-social.git Make EmailRegistration respect registration flags The email registration code wasn't respecting site-closed or site-inviteonly flags. This is fixed. --- diff --git a/plugins/EmailRegistration/emailregister.php b/plugins/EmailRegistration/emailregister.php index 2d32b40456..2e69758e84 100644 --- a/plugins/EmailRegistration/emailregister.php +++ b/plugins/EmailRegistration/emailregister.php @@ -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);