@@ -79,7 +79,7 @@ public function turnstileSiteKey(): string
7979 return $ this ->turnstile ['secret_key ' ] !== '' ? $ this ->turnstile ['site_key ' ] : '' ;
8080 }
8181
82- public function verifyTurnstile (string $ token , ? string $ remoteIp ): bool
82+ public function verifyTurnstile (string $ token , string $ remoteIp ): bool
8383 {
8484 if ($ this ->turnstileSiteKey () === '' ) {
8585 return true ;
@@ -93,7 +93,7 @@ public function verifyTurnstile(string $token, ?string $remoteIp): bool
9393 'secret ' => $ this ->turnstile ['secret_key ' ],
9494 'response ' => $ token ,
9595 ];
96- if ($ remoteIp ) {
96+ if ($ remoteIp !== '' ) {
9797 $ data ['remoteip ' ] = $ remoteIp ;
9898 }
9999
@@ -176,11 +176,11 @@ public function validate(array $data): array
176176 /**
177177 * @param ContactData $data
178178 */
179- public function send (array $ data ): bool
179+ public function send (array $ data, string $ ipAddress = '' ): bool
180180 {
181181 $ this ->mailService ->getMessage ()->setReplyTo ($ data ['email ' ], $ data ['name ' ]);
182182 $ this ->mailService ->setSubject ('New contact form submission on dotkernel.com ' );
183- $ this ->mailService ->setBody ($ this ->buildBody ($ data ));
183+ $ this ->mailService ->setBody ($ this ->buildBody ($ data, $ ipAddress ));
184184
185185 try {
186186 $ result = $ this ->mailService ->send ();
@@ -237,7 +237,7 @@ private function stringValue(array $raw, string $key): string
237237 /**
238238 * @param ContactData $data
239239 */
240- private function buildBody (array $ data ): string
240+ private function buildBody (array $ data, string $ ipAddress ): string
241241 {
242242 $ rows = [
243243 'Topic ' => ContactTopicEnum ::tryFrom ($ data ['topic ' ])?->label() ?? '' ,
@@ -247,6 +247,7 @@ private function buildBody(array $data): string
247247 'Current stack ' => $ data ['stack ' ],
248248 'Message ' => $ data ['message ' ],
249249 'Query params ' => $ data ['query ' ],
250+ 'IP address ' => $ ipAddress ,
250251 ];
251252
252253 $ html = '' ;
0 commit comments