1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Registration: Reviewed added simple honeypot, added testing

Also cleaned up old RegistrationController syntax.
Review of #4970
This commit is contained in:
Dan Brown
2024-05-04 13:59:41 +01:00
parent 0d2a268be0
commit 5c28bcf865
3 changed files with 26 additions and 16 deletions

View File

@@ -184,4 +184,23 @@ class RegistrationTest extends TestCase
$resp->assertSee('The email must be a valid email address.');
$resp->assertSee('The password must be at least 8 characters.');
}
public function test_registration_simple_honeypot_active()
{
$this->setSettings(['registration-enabled' => 'true']);
$resp = $this->get('/register');
$this->withHtml($resp)->assertElementExists('form input[name="username"]');
$resp = $this->post('/register', [
'name' => 'Barry',
'email' => 'barrybot@example.com',
'password' => 'barryIsTheBestBot',
'username' => 'MyUsername'
]);
$resp->assertRedirect('/register');
$resp = $this->followRedirects($resp);
$this->withHtml($resp)->assertElementExists('form input[name="username"].text-neg');
}
}