Skip to content

Commit 76d4626

Browse files
committed
fix #5153 updated: chose whether to respond with empty response or redirection
Check whether header 'X-Requested-With' is not empty, similar as done in HandleExceptions.php so actual value of the header may change and not affect this behaviour.
1 parent 02310b2 commit 76d4626

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/Http/RequestHandlers/Logout.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ public function handle(ServerRequestInterface $request): ResponseInterface
5151
FlashMessages::addMessage(I18N::translate('You have signed out.'));
5252
}
5353

54-
return response();
54+
if ($request->getHeaderLine('X-Requested-With') !== '') {
55+
// Ajax request - send empty response
56+
return response();
57+
} else {
58+
// Form submission - redirect to home page
59+
return redirect(HomePage::class);
60+
}
5561
}
5662
}

0 commit comments

Comments
 (0)