Skip to content

Commit 82f1924

Browse files
committed
removes check on set emailservice and removes $isValid variable
1 parent e52471d commit 82f1924

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/controllers/ContactController.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ public function contact(Request $request, PDO $db)
6565
throw new Exception("This client cannot perform this action", 403);
6666
}
6767

68-
if (! isset($this->emailService)) {
69-
throw new RuntimeException('The emailservice has not been set');
70-
}
71-
7268
$fields = ['name', 'email', 'subject', 'comment'];
7369
$error = [];
7470
$data = [];
@@ -89,13 +85,11 @@ public function contact(Request $request, PDO $db)
8985
throw new Exception($message, 400);
9086
}
9187

92-
$isValid = $this->spamCheckService->isCommentAcceptable(
88+
if (!$this->spamCheckService->isCommentAcceptable(
9389
$data,
9490
$request->getClientIP(),
9591
$request->getClientUserAgent()
96-
);
97-
98-
if (!$isValid) {
92+
)) {
9993
throw new Exception("Comment failed spam check", 400);
10094
}
10195

0 commit comments

Comments
 (0)