mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Updated functionality for logging failed access
- Added testing to cover. - Linked logging into Laravel's monolog logging system and made log channel configurable. - Updated env var names to be specific to login access. - Added extra locations as to where failed logins would be captured. Related to #1881 and #728
This commit is contained in:
@ -593,4 +593,17 @@ class LdapTest extends BrowserKitTest
|
||||
|
||||
$this->see('A user with the email tester@example.com already exists but with different credentials');
|
||||
}
|
||||
|
||||
public function test_failed_logins_are_logged_when_message_configured()
|
||||
{
|
||||
$log = $this->withTestLogger();
|
||||
config()->set(['logging.failed_login.message' => 'Failed login for %u']);
|
||||
|
||||
$this->commonLdapMocks(1, 1, 1, 1, 1);
|
||||
$this->mockLdap->shouldReceive('searchAndGetEntries')->times(1)
|
||||
->andReturn(['count' => 0]);
|
||||
|
||||
$this->post('/login', ['username' => 'timmyjenkins', 'password' => 'cattreedog']);
|
||||
$this->assertTrue($log->hasWarningThatContains('Failed login for timmyjenkins'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user