From d26481dbe8473831b6027458da33cdda28951eac Mon Sep 17 00:00:00 2001 From: Pellaeon Lin Date: Sun, 31 Aug 2014 13:39:51 +0000 Subject: [PATCH] Correctly display error message --- controller/registercontroller.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/controller/registercontroller.php b/controller/registercontroller.php index 612a96d..05a07d1 100644 --- a/controller/registercontroller.php +++ b/controller/registercontroller.php @@ -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