Skip to content

Commit 33a882d

Browse files
[11.x] Use Date facade for storing the password confirmation timestamp (#54383)
This matches the changes via laravel/fortify#520 -------------- Currently, the password confirmation endpoint uses PHP's inbuilt `time()` function. This does not consider `freezeSecond()` or `Date::setTestNow()`. Leading to inconsistent results during tests. This update maintains compatibility with existing features as both `time()` and `->unix()` return a UNIX timestamp. Signed-off-by: Mior Muhammad Zaki <[email protected]> Co-authored-by: Chris van Lier <[email protected]>
1 parent d141865 commit 33a882d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Illuminate/Session/Store.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Contracts\Session\Session;
77
use Illuminate\Support\Arr;
88
use Illuminate\Support\Collection;
9+
use Illuminate\Support\Facades\Date;
910
use Illuminate\Support\MessageBag;
1011
use Illuminate\Support\Str;
1112
use Illuminate\Support\Traits\Macroable;
@@ -785,7 +786,7 @@ public function setPreviousUrl($url)
785786
*/
786787
public function passwordConfirmed()
787788
{
788-
$this->put('auth.password_confirmed_at', time());
789+
$this->put('auth.password_confirmed_at', Date::now()->unix());
789790
}
790791

791792
/**

src/Illuminate/Support/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"illuminate/conditionable": "^11.0",
2424
"illuminate/contracts": "^11.0",
2525
"illuminate/macroable": "^11.0",
26-
"nesbot/carbon": "^2.72.2|^3.4",
26+
"nesbot/carbon": "^2.72.6|^3.8.4",
2727
"voku/portable-ascii": "^2.0.2"
2828
},
2929
"conflict": {

0 commit comments

Comments
 (0)