Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 25, 2018
1 parent a8338c0 commit 2d78e5d
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function handle($request, Closure $next)
$this->tokensMatch($request)
) {
return tap($next($request), function ($response) use ($request) {
if ($this->shouldAddHttpCookie()) {
if ($this->shouldAddXsrfTokenCookie()) {
$this->addCookieToResponse($request, $response);
}
});
Expand Down Expand Up @@ -156,6 +156,16 @@ protected function getTokenFromRequest($request)
return $token;
}

/**
* Determine if the cookie should be added to the response.
*
* @return bool
*/
public function shouldAddXsrfTokenCookie()
{
return $this->addHttpCookie;
}

/**
* Add the CSRF token to the response cookies.
*
Expand Down Expand Up @@ -186,19 +196,4 @@ public static function serialized()
{
return EncryptCookies::serialized('XSRF-TOKEN');
}

/*
* Get the decision to add the Http cookie to the request..
*
* @return bool
*/

public function shouldAddHttpCookie()
{
if (method_exists($this, 'addHttpCookie')) {
return $this->addHttpCookie();
}

return property_exists($this, 'addHttpCookie') ? $this->addHttpCookie : true;
}
}

0 comments on commit 2d78e5d

Please sign in to comment.