From 48f6da2bc3d748bd35c22bf3ff89eff199df0f3e Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Wed, 2 Dec 2015 18:11:18 +0100 Subject: [PATCH] Handle case where the email plugin "from" email is not configured --- classes/controller.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/classes/controller.php b/classes/controller.php index 2fc54785..9655a1ec 100644 --- a/classes/controller.php +++ b/classes/controller.php @@ -270,6 +270,13 @@ class AdminController $sitename = $this->grav['config']->get('site.title', 'Website'); $from = $this->grav['config']->get('plugins.email.from', 'noreply@getgrav.org'); + + if (empty($from)) { + $this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.FORGOT_EMAIL_NOT_CONFIGURED'), 'error'); + $this->setRedirect('/forgot'); + return true; + } + $to = $user->email; $subject = $this->admin->translate(['PLUGIN_ADMIN.FORGOT_EMAIL_SUBJECT', $sitename]);