Skip to content

Commit

Permalink
[6.x] Fix the value generated when setting encrypted cookies (#857)
Browse files Browse the repository at this point in the history
* Fix the value generated when setting encrypted cookies

* Update InteractsWithCookies.php

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
code-distortion and taylorotwell authored Jan 26, 2021
1 parent dd3f15d commit c4ddce9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Concerns/InteractsWithCookies.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ public function plainCookie($name, $value = null, $expiry = null, array $options
public function addCookie($name, $value, $expiry = null, array $options = [], $encrypt = true)
{
if ($encrypt) {
$value = encrypt($value, $serialize = false);
$prefix = CookieValuePrefix::create($name, Crypt::getKey());

$value = encrypt($prefix.$value, $serialize = false);
}

if ($expiry instanceof DateTimeInterface) {
Expand Down

0 comments on commit c4ddce9

Please sign in to comment.