Fix pint issues

This commit is contained in:
Bubka 2024-04-26 08:01:20 +02:00
parent c6f8317d81
commit 7e1fdf67bb
18 changed files with 75 additions and 86 deletions

View File

@ -61,7 +61,7 @@ public function toArray($request)
'platform' => $this->agent->platform(),
'device' => $this->agent->deviceType(),
'login_at' => $this->login_at
? Carbon::parse($this->login_at,)->tz($tz)->toDayDateTimeString()
? Carbon::parse($this->login_at)->tz($tz)->toDayDateTimeString()
: null,
'logout_at' => $this->logout_at
? Carbon::parse($this->logout_at)->tz($tz)->toDayDateTimeString()

View File

@ -31,8 +31,6 @@ class FailedLoginListener extends AbstractAccessListener
{
/**
* Handle the event.
*
* @return void
*/
public function handle(mixed $event) : void
{

View File

@ -32,8 +32,6 @@ class LoginListener extends AbstractAccessListener
{
/**
* Handle the event.
*
* @return void
*/
public function handle(mixed $event) : void
{

View File

@ -31,8 +31,6 @@ class LogoutListener extends AbstractAccessListener
{
/**
* Handle the event.
*
* @return void
*/
public function handle(mixed $event) : void
{

View File

@ -31,8 +31,6 @@ class OtherDeviceLogoutListener extends AbstractAccessListener
{
/**
* Handle the event.
*
* @return void
*/
public function handle(mixed $event) : void
{

View File

@ -4,7 +4,6 @@
use App\Events\VisitedByProxyUser;
use App\Extensions\RemoteUserProvider;
use App\Listeners\Authentication\AbstractAccessListener;
use App\Notifications\SignedInWithNewDevice;
use Illuminate\Support\Carbon;
@ -12,8 +11,6 @@ class VisitedByProxyUserListener extends AbstractAccessListener
{
/**
* Handle the event.
*
* @return void
*/
public function handle(mixed $event) : void
{

View File

@ -2,8 +2,8 @@
namespace App\Models;
use App\Models\Traits\WebAuthnManageCredentials;
use App\Models\Traits\HasAuthenticationLog;
use App\Models\Traits\WebAuthnManageCredentials;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Auth\Notifications\ResetPassword;
use Illuminate\Contracts\Translation\HasLocalePreference;
@ -53,8 +53,8 @@
*/
class User extends Authenticatable implements HasLocalePreference, WebAuthnAuthenticatable
{
use HasAuthenticationLog;
use HasApiTokens, HasFactory, Notifiable;
use HasAuthenticationLog;
use WebAuthnAuthentication, WebAuthnManageCredentials;
/**

View File

@ -2,15 +2,15 @@
namespace App\Providers;
use App\Listeners\Authentication\VisitedByProxyUserListener;
use App\Events\GroupDeleted;
use App\Events\GroupDeleting;
use App\Events\VisitedByProxyUser;
use App\Events\ScanForNewReleaseCalled;
use App\Events\TwoFAccountDeleted;
use App\Events\VisitedByProxyUser;
use App\Listeners\Authentication\FailedLoginListener;
use App\Listeners\Authentication\LoginListener;
use App\Listeners\Authentication\LogoutListener;
use App\Listeners\Authentication\VisitedByProxyUserListener;
use App\Listeners\CleanIconStorage;
use App\Listeners\DissociateTwofaccountFromGroup;
use App\Listeners\LogNotification;

View File

@ -58,14 +58,17 @@ protected function getUserByToken($token)
*/
public function refreshToken($refreshToken)
{
return $this->getHttpClient()->post($this->getTokenUrl(), [/** @phpstan-ignore-line */
return $this->getHttpClient()->post( /** @phpstan-ignore-line */
$this->getTokenUrl(),
[
RequestOptions::FORM_PARAMS => [
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
'grant_type' => 'refresh_token',
'refresh_token' => $refreshToken,
],
]);
]
);
}
/**

View File

@ -96,36 +96,36 @@ public function test_index_returns_all_users_with_expected_UserManagerResources(
->assertJsonCount(3)
->assertJsonStructure([
'*' => [
"last_seen_at",
"created_at",
]
'last_seen_at',
'created_at',
],
])
->assertJsonFragment([
"id" => $this->user->id,
"name" => $this->user->name,
"email" => $this->user->email,
"oauth_provider" => null,
"preferences" => $this->defaultPreferences,
"is_admin" => false,
"twofaccounts_count" => 0,
'id' => $this->user->id,
'name' => $this->user->name,
'email' => $this->user->email,
'oauth_provider' => null,
'preferences' => $this->defaultPreferences,
'is_admin' => false,
'twofaccounts_count' => 0,
])
->assertJsonFragment([
"id" => $this->admin->id,
"name" => $this->admin->name,
"email" => $this->admin->email,
"oauth_provider" => null,
"preferences" => $this->defaultPreferences,
"is_admin" => true,
"twofaccounts_count" => 0,
'id' => $this->admin->id,
'name' => $this->admin->name,
'email' => $this->admin->email,
'oauth_provider' => null,
'preferences' => $this->defaultPreferences,
'is_admin' => true,
'twofaccounts_count' => 0,
])
->assertJsonFragment([
"id" => $this->anotherUser->id,
"name" => $this->anotherUser->name,
"email" => $this->anotherUser->email,
"oauth_provider" => null,
"preferences" => $this->defaultPreferences,
"is_admin" => false,
"twofaccounts_count" => 1,
'id' => $this->anotherUser->id,
'name' => $this->anotherUser->name,
'email' => $this->anotherUser->email,
'oauth_provider' => null,
'preferences' => $this->defaultPreferences,
'is_admin' => false,
'twofaccounts_count' => 1,
]);
}
@ -137,20 +137,20 @@ public function test_show_returns_the_expected_UserManagerResource() : void
$this->actingAs($this->admin, 'api-guard')
->json('GET', '/api/v1/users/' . $this->user->id)
->assertJson([
"info" => [
"id" => $this->user->id,
"name" => $this->user->name,
"email" => $this->user->email,
"oauth_provider" => null,
"preferences" => $this->defaultPreferences,
"is_admin" => false,
"twofaccounts_count" => 0,
"last_seen_at" => "1 second ago",
"created_at" => "1 second ago"
'info' => [
'id' => $this->user->id,
'name' => $this->user->name,
'email' => $this->user->email,
'oauth_provider' => null,
'preferences' => $this->defaultPreferences,
'is_admin' => false,
'twofaccounts_count' => 0,
'last_seen_at' => '1 second ago',
'created_at' => '1 second ago',
],
"password_reset" => null,
"valid_personal_access_tokens" => 0,
"webauthn_credentials" => 0
'password_reset' => null,
'valid_personal_access_tokens' => 0,
'webauthn_credentials' => 0,
]);
}

View File

@ -98,7 +98,7 @@ public function test_login_send_new_device_notification()
'email' => $this->user->email,
'password' => self::PASSWORD,
], [
'HTTP_USER_AGENT' => 'NotSymfony'
'HTTP_USER_AGENT' => 'NotSymfony',
])->assertOk();
Notification::assertSentTo($this->user, SignedInWithNewDevice::class);
@ -128,7 +128,7 @@ public function test_login_does_not_send_new_device_notification()
'email' => $this->user->email,
'password' => self::PASSWORD,
], [
'HTTP_USER_AGENT' => 'NotSymfony'
'HTTP_USER_AGENT' => 'NotSymfony',
])->assertOk();
Notification::assertNothingSentTo($this->user);

View File

@ -3,11 +3,8 @@
namespace Tests\Unit\Listeners\Authentication;
use App\Listeners\Authentication\LoginListener;
use App\Models\User;
use Illuminate\Auth\Events\Login;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Event;
use Mockery;
use PHPUnit\Framework\Attributes\CoversClass;
use Tests\TestCase;