Block Temporary mail addresses (#116)

* Block Temporary mail addresses

* Update vapor, disable cache disposable mail

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Chirag Chhatrala
2023-04-28 15:07:39 +05:30
committed by GitHub
parent 45fb114554
commit cd14084d7a
10 changed files with 1210 additions and 796 deletions

View File

@@ -2,6 +2,7 @@
use App\Models\User;
use Tests\TestCase;
use function Pest\Faker\faker;
it('can register', function () {
$this->postJson('/api/register', [
@@ -32,3 +33,32 @@ it('cannot register with existing email', function () {
->assertStatus(422)
->assertJsonValidationErrors(['email']);
});
it('cannot register with disposable email', function () {
// Select random email
$email = faker()->randomElement([
'dumliyupse@gufum.com',
'kcs79722@zslsz.com',
'pfizexwxtdifxupdhr@tpwlb.com',
'qvj86ypqfm@email.edu.pl'
]);
$this->postJson('/api/register', [
'name' => 'Test disposable',
'email' => $email,
'hear_about_us' => 'google',
'password' => 'secret',
'password_confirmation' => 'secret',
'agree_terms' => true
])
->assertStatus(422)
->assertJsonValidationErrors(['email'])
->assertJson([
'message' => 'Disposable email addresses are not allowed.',
'errors' => [
'email' => [
'Disposable email addresses are not allowed.',
],
],
]);
});