fix(notifications): point the new login in-app url at account.security
This commit is contained in:
1 parent
09d0159805
commit
1dcb00b39f
3 files changed
+60
-1
No files matched your search
@@ -3,6 +3,7 @@
|
||||
namespace Tests\Feature\Auth;
|
||||
|
||||
use App\Livewire\Auth\Login;
|
||||
use App\Models\NotificationTemplate;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
@@ -56,6 +57,35 @@ class LoginTest extends TestCase
|
||||
$this->assertAuthenticated();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a login from a new ip sends the in-app alert to a user who opted in
|
||||
*/
|
||||
public function test_can_login_with_in_app_new_login_alert_enabled()
|
||||
{
|
||||
$user = User::factory()->create([
|
||||
'email' => 'tests@paymenter.org',
|
||||
'password' => Hash::make('password'),
|
||||
]);
|
||||
|
||||
$user->notificationsPreferences()->create([
|
||||
'notification_template_id' => NotificationTemplate::where('key', 'new_login_detected')->value('id'),
|
||||
'mail_enabled' => true,
|
||||
'in_app_enabled' => true,
|
||||
]);
|
||||
|
||||
Livewire::test(Login::class)
|
||||
->set('email', 'tests@paymenter.org')
|
||||
->set('password', 'password')
|
||||
->call('submit')
|
||||
->assertHasNoErrors()
|
||||
->assertRedirect(route('dashboard'));
|
||||
|
||||
$this->assertDatabaseHas('notifications', [
|
||||
'user_id' => $user->id,
|
||||
'url' => route('account.security'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the user can't login with valid credentials but wrong captcha
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user