feat(auth): harden authentication and add configurable two-factor support
This commit is contained in:
@@ -8,6 +8,10 @@ use Illuminate\Support\Facades\URL;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
config(['auth-ui.features.two_factor_required' => false]);
|
||||
});
|
||||
|
||||
it('does not send verification email when feature is disabled', function () {
|
||||
config(['auth-ui.features.email_verification' => false]);
|
||||
|
||||
@@ -18,8 +22,8 @@ it('does not send verification email when feature is disabled', function () {
|
||||
'first_name' => 'Test',
|
||||
'last_name' => 'User',
|
||||
'email' => 'test@example.com',
|
||||
'password' => 'password123',
|
||||
'password_confirmation' => 'password123',
|
||||
'password' => 'correct horse battery staple',
|
||||
'password_confirmation' => 'correct horse battery staple',
|
||||
]);
|
||||
|
||||
Notification::assertNothingSent();
|
||||
@@ -35,8 +39,8 @@ it('sends verification email when feature is enabled', function () {
|
||||
'first_name' => 'Test',
|
||||
'last_name' => 'User',
|
||||
'email' => 'test@example.com',
|
||||
'password' => 'password123',
|
||||
'password_confirmation' => 'password123',
|
||||
'password' => 'correct horse battery staple',
|
||||
'password_confirmation' => 'correct horse battery staple',
|
||||
]);
|
||||
|
||||
$user = User::where('email', 'test@example.com')->first();
|
||||
@@ -135,8 +139,8 @@ it('redirects to verification notice after registration when feature is enabled'
|
||||
'first_name' => 'New',
|
||||
'last_name' => 'User',
|
||||
'email' => 'new@example.com',
|
||||
'password' => 'password123',
|
||||
'password_confirmation' => 'password123',
|
||||
'password' => 'correct horse battery staple',
|
||||
'password_confirmation' => 'correct horse battery staple',
|
||||
])->assertRedirect('/email/verify');
|
||||
});
|
||||
|
||||
@@ -148,7 +152,7 @@ it('redirects to home after registration when feature is disabled', function ()
|
||||
'first_name' => 'New',
|
||||
'last_name' => 'User',
|
||||
'email' => 'new@example.com',
|
||||
'password' => 'password123',
|
||||
'password_confirmation' => 'password123',
|
||||
'password' => 'correct horse battery staple',
|
||||
'password_confirmation' => 'correct horse battery staple',
|
||||
])->assertRedirect('/dashboard');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user