Make EmailRegistration respect registration flags

The email registration code wasn't respecting site-closed or
site-inviteonly flags. This is fixed.
This commit is contained in:
Evan Prodromou 2011-05-02 19:12:29 -07:00
parent fde6e672cf
commit 784da5d231
1 changed files with 10 additions and 0 deletions

View 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);