1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2026-01-03 23:42:28 +03:00

Added login throttling test, updated reset-pw test method names

This commit is contained in:
Dan Brown
2022-09-22 17:29:38 +01:00
parent 90b4257889
commit 5c5ea64228
2 changed files with 17 additions and 4 deletions

View File

@@ -133,6 +133,19 @@ class AuthTest extends TestCase
$this->assertFalse(auth()->check());
}
public function test_login_attempts_are_rate_limited()
{
for ($i = 0; $i < 5; $i++) {
$resp = $this->login('bennynotexisting@example.com', 'pw123');
}
$resp = $this->followRedirects($resp);
$resp->assertSee('These credentials do not match our records.');
// Check the fifth attempt provides a lockout response
$resp = $this->followRedirects($this->login('bennynotexisting@example.com', 'pw123'));
$resp->assertSee('Too many login attempts. Please try again in');
}
/**
* Perform a login.
*/