Skip to content

Commit

Permalink
User module: check if recipient (user) for mail exists
Browse files Browse the repository at this point in the history
  • Loading branch information
blackcoder87 committed Nov 17, 2024
1 parent 9fff84b commit 3b13e93
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions application/modules/user/controllers/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,21 @@ class Mail extends \Ilch\Controller\Frontend
public function indexAction()
{
$userMapper = new UserMapper();

if (!$this->getRequest()->getParam('user') || !is_numeric($this->getRequest()->getParam('user'))) {
$this->redirect()
->withMessage('userNotFound', 'danger')
->to(['controller' => 'index', 'action' => 'index']);
}

$user = $userMapper->getUserById($this->getRequest()->getParam('user'));

if (!$user) {
$this->redirect()
->withMessage('userNotFound', 'danger')
->to(['controller' => 'index', 'action' => 'index']);
}

$this->getLayout()->getTitle()
->add($this->getTranslator()->trans('menuUserList'))
->add($user->getName())
Expand Down

0 comments on commit 3b13e93

Please sign in to comment.