blob: 6b48affe9d322fab0d462489b5d3a5396585642b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<?php
require_once __DIR__.'/../Base.php';
use Kanboard\Model\User;
use Kanboard\Model\Authentication;
class AuthenticationTest extends Base
{
public function testHasCaptcha()
{
$u = new User($this->container);
$a = new Authentication($this->container);
$this->assertFalse($a->hasCaptcha('not_found'));
$this->assertFalse($a->hasCaptcha('admin'));
$this->assertTrue($u->incrementFailedLogin('admin'));
$this->assertTrue($u->incrementFailedLogin('admin'));
$this->assertTrue($u->incrementFailedLogin('admin'));
$this->assertFalse($a->hasCaptcha('not_found'));
$this->assertTrue($a->hasCaptcha('admin'));
}
public function testHandleFailedLogin()
{
$u = new User($this->container);
$a = new Authentication($this->container);
$this->assertFalse($u->isLocked('admin'));
for ($i = 0; $i <= 6; $i++) {
$a->handleFailedLogin('admin');
}
$this->assertTrue($u->isLocked('admin'));
}
}
|