From 784da5d2319e51f7236874025ef4b55a76a79db8 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 2 May 2011 19:12:29 -0700 Subject: [PATCH] Make EmailRegistration respect registration flags The email registration code wasn't respecting site-closed or site-inviteonly flags. This is fixed. --- plugins/EmailRegistration/emailregister.php | 10 ++++++++++ 1 file changed, 10 insertions(+) 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);