diff --git a/app/Livewire/Auth/TwoFactorBackup.php b/app/Livewire/Auth/TwoFactorBackup.php index 856e6a5..14546b9 100644 --- a/app/Livewire/Auth/TwoFactorBackup.php +++ b/app/Livewire/Auth/TwoFactorBackup.php @@ -50,6 +50,6 @@ class TwoFactorBackup extends Component public function render() { - return view('livewire.auth.two-factor-backup')->title(__('auth.title_challenge')); + return view('livewire.auth.two-factor-backup')->title(__('auth.title_backup')); } } diff --git a/lang/de/auth.php b/lang/de/auth.php index 96ebb4f..87b1a4a 100644 --- a/lang/de/auth.php +++ b/lang/de/auth.php @@ -65,6 +65,7 @@ return [ 'title_login' => 'Anmelden — Clusev', 'title_password_change' => 'Passwort ändern — Clusev', 'title_challenge' => 'Bestätigung — Clusev', + 'title_backup' => 'Backup-Code — Clusev', 'title_setup' => '2FA einrichten — Clusev', // ── Validation / error messages ────────────────────────────────────── diff --git a/lang/en/auth.php b/lang/en/auth.php index 1504bf4..199a3bf 100644 --- a/lang/en/auth.php +++ b/lang/en/auth.php @@ -65,6 +65,7 @@ return [ 'title_login' => 'Sign in — Clusev', 'title_password_change' => 'Change password — Clusev', 'title_challenge' => 'Verification — Clusev', + 'title_backup' => 'Backup code — Clusev', 'title_setup' => 'Set up 2FA — Clusev', // ── Validation / error messages ────────────────────────────────────── diff --git a/resources/views/livewire/auth/two-factor-backup.blade.php b/resources/views/livewire/auth/two-factor-backup.blade.php index 6e97073..ef7aa71 100644 --- a/resources/views/livewire/auth/two-factor-backup.blade.php +++ b/resources/views/livewire/auth/two-factor-backup.blade.php @@ -14,7 +14,7 @@
- @error('code')

{{ $message }}

@enderror
diff --git a/tests/Feature/TwoFactorBackupTest.php b/tests/Feature/TwoFactorBackupTest.php index 96b83f8..25c3a3a 100644 --- a/tests/Feature/TwoFactorBackupTest.php +++ b/tests/Feature/TwoFactorBackupTest.php @@ -67,6 +67,20 @@ class TwoFactorBackupTest extends TestCase $this->assertGuest(); } + public function test_empty_code_is_rejected(): void + { + $user = $this->enrolledUser(); + $user->replaceRecoveryCodes(); + session()->put('2fa.user', $user->id); + + Livewire::test(TwoFactorBackup::class) + ->set('code', '') + ->call('verify') + ->assertHasErrors('code'); + + $this->assertGuest(); + } + public function test_a_totp_code_is_not_accepted_on_the_backup_view(): void { $user = $this->enrolledUser();