Skip to content

Commit

Permalink
Merge pull request #14 from andreascreten/remove-cookie-from-response
Browse files Browse the repository at this point in the history
Remove the cookie from the response if Trans SID is in use
  • Loading branch information
Lucas-Schmukas authored Jul 18, 2023
2 parents e3d0092 + 7279ec5 commit 0220f52
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/StartSessionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace iMi\LaravelTransSid;

use Illuminate\Contracts\Session\Session;
use Symfony\Component\HttpFoundation\Response;

class StartSessionMiddleware extends \Illuminate\Session\Middleware\StartSession
{

Expand Down Expand Up @@ -63,4 +66,14 @@ public function getSession(\Illuminate\Http\Request $request)

return $session;
}

protected function addCookieToResponse(Response $response, Session $session)
{
// Do not add cookie if TransSID is active
if ($session->has(self::LOCKED_FIELD)) {
return;
}

parent::addCookieToResponse($response, $session);
}
}

0 comments on commit 0220f52

Please sign in to comment.