From e4c08c37657c185582ca34c2136999c2248f8b12 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Sun, 8 Dec 2024 23:50:47 +0100 Subject: [PATCH] Cleanup --- app/User.php | 2 +- modules/Auth/Components/PasswordResetTest.php | 5 +-- .../Auth/Mails}/ResetPassword.php | 4 +- .../Authentication/ForgotPasswordTest.php | 44 ------------------- 4 files changed, 4 insertions(+), 51 deletions(-) rename {app/Auth => modules/Auth/Mails}/ResetPassword.php (89%) delete mode 100644 tests/Feature/Authentication/ForgotPasswordTest.php diff --git a/app/User.php b/app/User.php index 5376e63d..dfebec5a 100644 --- a/app/User.php +++ b/app/User.php @@ -2,11 +2,11 @@ namespace App; -use App\Auth\ResetPassword; use Database\Factories\UserFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +use Modules\Auth\Mails\ResetPassword; class User extends Authenticatable { diff --git a/modules/Auth/Components/PasswordResetTest.php b/modules/Auth/Components/PasswordResetTest.php index 8982260e..6c24b29c 100644 --- a/modules/Auth/Components/PasswordResetTest.php +++ b/modules/Auth/Components/PasswordResetTest.php @@ -2,13 +2,10 @@ namespace Modules\Auth\Components; -use App\Auth\ResetPassword; +use Modules\Auth\Mails\ResetPassword; use App\User; -use Illuminate\Auth\Events\Lockout; use Tests\TestCase; use Illuminate\Foundation\Testing\DatabaseTransactions; -use Illuminate\Support\Facades\Event; -use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Notification; use Livewire\Livewire; diff --git a/app/Auth/ResetPassword.php b/modules/Auth/Mails/ResetPassword.php similarity index 89% rename from app/Auth/ResetPassword.php rename to modules/Auth/Mails/ResetPassword.php index 61ce8508..5c6368c1 100644 --- a/app/Auth/ResetPassword.php +++ b/modules/Auth/Mails/ResetPassword.php @@ -1,6 +1,6 @@ subject(Lang::get('Passwort zurücksetzen | Adrema')) + ->subject(Lang::get('Passwort zurücksetzen | ' . config('app.name'))) ->line(Lang::get('Du erhälst diese E-Mail, weil du eine Anfrage zum zurücksetzen deines Account-Passworts gestellt hast.')) ->action(Lang::get('Passwort zurücksetzen'), $url) ->line(Lang::get('Dieser Link wird in :count Minuten ablaufen.', ['count' => config('auth.passwords.' . config('auth.defaults.passwords') . '.expire')])) diff --git a/tests/Feature/Authentication/ForgotPasswordTest.php b/tests/Feature/Authentication/ForgotPasswordTest.php deleted file mode 100644 index c0688cfa..00000000 --- a/tests/Feature/Authentication/ForgotPasswordTest.php +++ /dev/null @@ -1,44 +0,0 @@ -withoutExceptionHandling(); - $this->get('/password/reset')->assertComponent('authentication/PasswordReset'); - } - - public function testItRequiresAnEmailAddress(): void - { - $this->postJson('/password/email')->assertJsonValidationErrors(['email' => 'E-Mail Adresse ist erforderlich.']); - } - - public function testItNeedsAnActiveUser(): void - { - $this->postJson('/password/email', [ - 'email' => 'test@aa.de', - ])->assertJsonValidationErrors(['email' => 'Es konnte leider kein Nutzer mit dieser E-Mail-Adresse gefunden werden.']); - } - - public function testItSendsPasswordResetLink(): void - { - Notification::fake(); - - $user = User::factory()->create(['email' => 'test@aa.de']); - $this->postJson('/password/email', [ - 'email' => 'test@aa.de', - ])->assertOk(); - - Notification::assertSentTo($user, ResetPassword::class); - } -}