Correctly display error message

This commit is contained in:
Pellaeon Lin 2014-08-31 13:39:51 +00:00
parent 38f0673f2b
commit d26481dbe8
1 changed files with 13 additions and 4 deletions

View File

@ -55,13 +55,22 @@ class RegisterController extends Controller {
public function validateEmail() {
$email = $this->request->getParam('email');
if ( !filter_var($email, FILTER_VALIDATE_EMAIL) ) {
$this->askEmail($this->l10n->t('Email address you entered is not valid'), true);
return;
return new TemplateResponse('', 'error', array(array('error' => $this->l10n->t('Email address you entered is not valid'))), 'error');
return new TemplateResponse('', 'error', array(
'errors' => array(array(
'error' => $this->l10n->t('Email address you entered is not valid'),
'hint' => ''
))
), 'error');
}
if ( $this->pendingreg->find($email) ) {
$this->askEmail($this->l10n->t('There is already a pending registration with this email'), true);
return;
return new TemplateResponse('', 'error', array(
'errors' => array(array(
'error' => $this->l10n->t('There is already a pending registration with this email'),
'hint' => ''
))
), 'error');
}
// FEATURE: allow only from specific email domain