From 7d6d6c068efc4fa3b45e12d40ebdda00dc40aa07 Mon Sep 17 00:00:00 2001 From: Pellaeon Lin Date: Sat, 29 Aug 2015 20:56:39 +0800 Subject: [PATCH] Update# feature to resend verification email --- appinfo/routes.php | 1 + controller/registercontroller.php | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index 2b52251..e2c8d0f 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -25,6 +25,7 @@ $application->registerRoutes($this, array('routes' => array( array('name' => 'settings#admin', 'url' => '/settings', 'verb' => 'POST'), array('name' => 'register#askEmail', 'url' => '/', 'verb' => 'GET'), array('name' => 'register#validateEmail', 'url' => '/', 'verb' => 'POST'), + array('name' => 'register#resendEmail', 'url' => '/resend/{email}', 'verb' => 'GET'), array('name' => 'register#verifyToken', 'url' => '/verify/{token}', 'verb' => 'GET'), array('name' => 'register#createAccount', 'url' => '/verify/{token}', 'verb' => 'POST') ))); diff --git a/controller/registercontroller.php b/controller/registercontroller.php index 24285dc..2d1084c 100644 --- a/controller/registercontroller.php +++ b/controller/registercontroller.php @@ -59,6 +59,16 @@ class RegisterController extends Controller { return new TemplateResponse('registration', 'register', $params, 'guest'); } + /** + * @NoAdminRequired + * @NoCSRFRequired + * @PublicPage + * @param string $email + */ + public function resendEmail($email) { + return $this->sendVerificationEmail($email); + } + /** * @NoAdminRequired * @NoCSRFRequired @@ -79,7 +89,9 @@ class RegisterController extends Controller { return new TemplateResponse('', 'error', array( 'errors' => array(array( 'error' => $this->l10n->t('There is already a pending registration with this email'), - 'hint' => '' + 'hint' => str_replace('{href}', + $this->urlgenerator->linkToRoute('registration.register.resendEmail', array('email' => $email)), + $this->l10n->t('Click here to re-send the verification email')) )) ), 'error'); } @@ -114,7 +126,7 @@ class RegisterController extends Controller { } } - return sendVerificationEmail($email); + return $this->sendVerificationEmail($email); } /** @@ -136,7 +148,7 @@ class RegisterController extends Controller { } catch (\Exception $e) { return new TemplateResponse('', 'error', array( 'errors' => array(array( - 'error' => $this->l10n->t('A problem occurred sending email, please contact your administrator.') + 'error' => $this->l10n->t('A problem occurred sending email, please contact your administrator.'), 'hint' => '' )) ), 'error');