From 8048b3fda8f351bd1bb0408f7031be16247044a9 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sun, 28 Aug 2022 17:47:56 +0200 Subject: [PATCH] app/controllers/backend/UserController.php: in activationEmailAction() only send activation email to suspended users. --- app/controllers/backend/UserController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/backend/UserController.php b/app/controllers/backend/UserController.php index c104381..efaded4 100644 --- a/app/controllers/backend/UserController.php +++ b/app/controllers/backend/UserController.php @@ -102,8 +102,12 @@ class UserController extends \Phalcon\Mvc\Controller { $user = User::findFirstById($id); if ($user) { - $this->eventsManager->fire('auth:onSentActivation', $user); - $this->flash->success('Ativation email sent to: ' . $user->email); + if ($user->isSuspended()) { + $this->eventsManager->fire('auth:onSentActivation', $user); + $this->flash->success('Ativation email sent to: ' . $user->email); + } else { + $this->flash->error('Only suspended users can be sent activation emails.'); + } } else { $this->flash->error('Invalid user: ' . $id); }