Disable account registering from disabled email provider

This commit is contained in:
Peter Papp
2021-07-23 13:28:40 +02:00
parent 8951ebc69f
commit eaec744356
30 changed files with 733 additions and 71 deletions

View File

@@ -60,6 +60,47 @@ class SignFlowTest extends TestCase
Notification::assertTimesSent(1, VerifyEmail::class);
}
/**
* @test
*/
public function it_try_register_when_registration_is_disabled()
{
Setting::create([
'name' => 'registration',
'value' => 0,
]);
$this->postJson('api/register', [
'email' => 'john@doe.com',
'password' => 'SecretPassword',
'password_confirmation' => 'SecretPassword',
'name' => 'John Doe',
])->assertStatus(401);
$this->assertDatabaseMissing('users', [
'email' => 'john@doe.com',
'email_verified_at' => null,
]);
}
/**
* @test
*/
public function it_try_register_from_disabled_email_provider()
{
$this->postJson('api/register', [
'email' => 'john@maildrop.cc',
'password' => 'SecretPassword',
'password_confirmation' => 'SecretPassword',
'name' => 'John Doe',
])->assertStatus(422);
$this->assertDatabaseMissing('users', [
'email' => 'john@doe.com',
'email_verified_at' => null,
]);
}
/**
* @test
*/