feat(auth): implement login security features including account locking and login attempt tracking
This commit is contained in:
@@ -18,6 +18,11 @@ class ResetPasswordControllerTest extends TestCase
|
||||
'email' => 'ada@example.com',
|
||||
'password' => 'OldSecret!123',
|
||||
]);
|
||||
$user->forceFill([
|
||||
'failed_login_attempts' => 5,
|
||||
'last_failed_login_at' => now(),
|
||||
'locked_until' => now()->addMinutes(15),
|
||||
])->save();
|
||||
$user->createToken('existing-session');
|
||||
$attempt = $user->resetPasswordAttempts()->create([
|
||||
'codigo' => '0123',
|
||||
@@ -38,6 +43,9 @@ class ResetPasswordControllerTest extends TestCase
|
||||
$this->assertFalse(Hash::check('OldSecret!123', $user->password));
|
||||
$this->assertSame(ResetPasswordAttempt::STATUS_USED, $attempt->fresh()->status);
|
||||
$this->assertDatabaseCount('personal_access_tokens', 0);
|
||||
$this->assertSame(0, $user->failed_login_attempts);
|
||||
$this->assertNull($user->last_failed_login_at);
|
||||
$this->assertNull($user->locked_until);
|
||||
}
|
||||
|
||||
public function test_it_rejects_a_pending_expired_or_used_attempt(): void
|
||||
|
||||
Reference in New Issue
Block a user