Kontakt: Hub-Domain-Anfragen gehen an die pressekonto-Brand-Adresse
Der WebPortalContext kennt nur die beiden Spokes - Anfragen von pressekonto.test waeren sonst bei businessportal24 gelandet. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
38d7cca086
commit
88d6935014
2 changed files with 21 additions and 1 deletions
|
|
@ -52,7 +52,13 @@ class ContactController extends Controller
|
|||
|
||||
private function recipient(): string
|
||||
{
|
||||
$brand = WebPortalContext::fromRequest()->domainConfig['brand'] ?? [];
|
||||
// Auch die Hub-Domain (pressekonto) nutzt das Formular — sie ist kein
|
||||
// Spoke-Portal, daher vor dem WebPortalContext am Host unterscheiden.
|
||||
if (str_contains(request()->getHost(), 'pressekonto')) {
|
||||
$brand = config('domains.domains.pressekonto.brand', []);
|
||||
} else {
|
||||
$brand = WebPortalContext::fromRequest()->domainConfig['brand'] ?? [];
|
||||
}
|
||||
|
||||
return $brand['contact_email'] ?? config('mail.from.address');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,20 @@ test('without a configured brand address the mail falls back to the from address
|
|||
Mail::assertSent(ContactRequestSubmitted::class, fn (ContactRequestSubmitted $mail) => $mail->hasTo('fallback@pressekonto.de'));
|
||||
});
|
||||
|
||||
test('a contact request from the hub domain goes to the pressekonto brand address', function () {
|
||||
/** @var TestCase $this */
|
||||
Mail::fake();
|
||||
config()->set('domains.domains.pressekonto.brand.contact_email', 'kontakt@pressekonto.de');
|
||||
|
||||
$this->post('https://pressekonto.test/de/kontakt', [
|
||||
'name' => 'Paula Presse',
|
||||
'email' => 'paula@example.test',
|
||||
'message' => 'Ich habe eine Frage zu Ihrer Plattform und bitte um Rückruf.',
|
||||
])->assertSessionHas('contact-status');
|
||||
|
||||
Mail::assertSent(ContactRequestSubmitted::class, fn (ContactRequestSubmitted $mail) => $mail->hasTo('kontakt@pressekonto.de'));
|
||||
});
|
||||
|
||||
test('honeypot submissions are silently accepted without sending mail', function () {
|
||||
/** @var TestCase $this */
|
||||
Mail::fake();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue