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

View File

@ -79,6 +79,10 @@ class EmailregisterAction extends Action
{ {
parent::prepare($argarray); parent::prepare($argarray);
if (common_config('site', 'closed')) {
throw new ClientException(_('Registration not allowed.'), 403);
}
if ($this->isPost()) { if ($this->isPost()) {
$this->checkSessionToken(); $this->checkSessionToken();
@ -86,6 +90,9 @@ class EmailregisterAction extends Action
$this->email = $this->trimmed('email'); $this->email = $this->trimmed('email');
if (!empty($this->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->email = common_canonical_email($this->email);
$this->state = self::NEWEMAIL; $this->state = self::NEWEMAIL;
} else { } else {
@ -119,6 +126,9 @@ class EmailregisterAction extends Action
$this->code = $this->trimmed('code'); $this->code = $this->trimmed('code');
if (empty($this->code)) { if (empty($this->code)) {
if (common_config('site', 'inviteonly')) {
throw new ClientException(_('Sorry, only invited people can register.'), 403);
}
$this->state = self::NEWREGISTER; $this->state = self::NEWREGISTER;
} else { } else {
$this->invitation = Invitation::staticGet('code', $this->code); $this->invitation = Invitation::staticGet('code', $this->code);