File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,11 @@ public static function getValidMagicLinkByToken($token)
128
128
129
129
return self ::where ('id ' , $ tokenId )
130
130
->where ('token ' , $ tokenSecret )
131
- ->where ('available_at ' , '>= ' , Carbon::now ())
131
+ ->where (function ($ query ) {
132
+ $ query
133
+ ->whereNull ('available_at ' )
134
+ ->orWhere ('available_at ' , '>= ' , Carbon::now ());
135
+ })
132
136
->where (function ($ query ) {
133
137
$ query
134
138
->whereNull ('max_visits ' )
Original file line number Diff line number Diff line change @@ -57,6 +57,14 @@ public function test_fails_when_date_is_expired()
57
57
->assertStatus (403 );
58
58
}
59
59
60
+ public function test_ok_when_date_is_null ()
61
+ {
62
+ $ magiclink = MagicLink::create (new LoginAction (User::first ()), null );
63
+
64
+ $ this ->get ($ magiclink ->url )
65
+ ->assertStatus (302 );
66
+ }
67
+
60
68
public function test_fail_when_max_visits_completed ()
61
69
{
62
70
$ magiclink = MagicLink::create (new LoginAction (User::first ()));
You can’t perform that action at this time.
0 commit comments