File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -412,6 +412,29 @@ public function resending_code_is_rate_limited()
412412 Notification::assertCount (2 );
413413 }
414414
415+ #[Test]
416+ public function frontend_resending_code_is_rate_limited ()
417+ {
418+ Notification::fake ();
419+ $ user = User::make ()->email ('foo@bar.com ' )->makeSuper ();
420+
421+ $ request = function () use ($ user ) {
422+ return $ this
423+ ->actingAs ($ user )
424+ ->from ('/original ' )
425+ ->get (route ('statamic.elevated-session.resend-code ' ));
426+ };
427+
428+ $ request ()->assertRedirect ('/original ' )->assertSessionHas ('status ' );
429+ $ request ()->assertRedirect ('/original ' )->assertSessionHas ('error ' , 'Try again in a minute. ' );
430+ $ this ->travel (30 )->seconds ();
431+ $ request ()->assertRedirect ('/original ' )->assertSessionHas ('error ' , 'Try again in a minute. ' );
432+ $ this ->travel (1 )->minute ();
433+ $ request ()->assertRedirect ('/original ' )->assertSessionHas ('status ' );
434+
435+ Notification::assertCount (2 );
436+ }
437+
415438 #[Test]
416439 public function the_verification_code_will_not_be_sent_if_the_user_has_a_password ()
417440 {
You can’t perform that action at this time.
0 commit comments