diff --git a/flexiapi/app/Http/Controllers/Account/ResetPasswordEmailController.php b/flexiapi/app/Http/Controllers/Account/ResetPasswordEmailController.php index bad748a..520260f 100644 --- a/flexiapi/app/Http/Controllers/Account/ResetPasswordEmailController.php +++ b/flexiapi/app/Http/Controllers/Account/ResetPasswordEmailController.php @@ -5,7 +5,6 @@ namespace App\Http\Controllers\Account; use App\ResetPasswordEmailToken; use App\Http\Controllers\Controller; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Auth; class ResetPasswordEmailController extends Controller { diff --git a/flexiapi/database/factories/AccountFactory.php b/flexiapi/database/factories/AccountFactory.php index f56d527..11bc97c 100644 --- a/flexiapi/database/factories/AccountFactory.php +++ b/flexiapi/database/factories/AccountFactory.php @@ -52,14 +52,14 @@ class AccountFactory extends Factory public function fromSpace(Space $space) { - return $this->state(fn (array $attributes) => [ + return $this->state(fn(array $attributes) => [ 'domain' => $space->domain ]); } public function admin() { - return $this->state(fn (array $attributes) => [ + return $this->state(fn(array $attributes) => [ 'admin' => true, ]); } @@ -79,21 +79,21 @@ class AccountFactory extends Factory public function deactivated() { - return $this->state(fn (array $attributes) => [ + return $this->state(fn(array $attributes) => [ 'activated' => false, ]); } public function withEmail() { - return $this->state(fn (array $attributes) => [ + return $this->state(fn(array $attributes) => [ 'email' => $this->faker->email, ]); } public function withConsumedAccountCreationToken() { - return $this->state(fn (array $attributes) => [])->afterCreating(function (Account $account) { + return $this->state(fn(array $attributes) => [])->afterCreating(function (Account $account) { $accountCreationToken = new AccountCreationToken; $accountCreationToken->token = 'test_token'; $accountCreationToken->account_id = $account->id; diff --git a/flexiapi/database/factories/PasswordFactory.php b/flexiapi/database/factories/PasswordFactory.php index cc5b2f1..6a3543f 100644 --- a/flexiapi/database/factories/PasswordFactory.php +++ b/flexiapi/database/factories/PasswordFactory.php @@ -33,8 +33,8 @@ class PasswordFactory extends Factory return [ 'account_id' => $account->id, - 'password' => hash('md5', $account->username.':'.$account->resolvedRealm.':testtest'), - 'algorithm' => 'MD5', + 'password' => hash('md5', $account->username . ':' . $account->resolvedRealm . ':testtest'), + 'algorithm' => 'MD5', ]; } @@ -55,18 +55,18 @@ class PasswordFactory extends Factory $account = Account::find($attributes['account_id']); return [ - 'password' => hash('sha256', $account->username.':'.$account->resolvedRealm.':testtest'), + 'password' => hash('sha256', $account->username . ':' . $account->resolvedRealm . ':testtest'), 'account_id' => $account->id, - 'algorithm' => 'SHA-256', + 'algorithm' => 'SHA-256', ]; }); } public function clrtxt() { - return $this->state(fn (array $attributes) => [ - 'password' => 'testtest', - 'algorithm' => 'CLRTXT', + return $this->state(fn(array $attributes) => [ + 'password' => 'testtest', + 'algorithm' => 'CLRTXT', ]); } } diff --git a/flexiapi/resources/views/errors/400.blade.php b/flexiapi/resources/views/errors/400.blade.php new file mode 100644 index 0000000..6fc57a7 --- /dev/null +++ b/flexiapi/resources/views/errors/400.blade.php @@ -0,0 +1,5 @@ +@extends('errors::minimal') + +@section('title', __('Bad Request')) +@section('code', '404') +@section('message', __($exception->getMessage() ?: 'Bad Request')) diff --git a/flexiapi/tests/Feature/AccountJWTAuthenticationTest.php b/flexiapi/tests/Feature/AccountJWTAuthenticationTest.php index b945261..4d067ad 100644 --- a/flexiapi/tests/Feature/AccountJWTAuthenticationTest.php +++ b/flexiapi/tests/Feature/AccountJWTAuthenticationTest.php @@ -19,7 +19,6 @@ namespace Tests\Feature; -use App\Account; use App\Password; use DateTimeImmutable; use Lcobucci\Clock\FrozenClock; @@ -198,7 +197,7 @@ class AccountJWTAuthenticationTest extends TestCase $value = 'authz_server="https://auth_bearer.com/" realm="realm"'; config()->set('app.account_authentication_bearer', $value); - $password = Password::factory()->create(); + Password::factory()->create(); $response = $this->json($this->method, $this->routeAccountMe) ->assertStatus(401); @@ -209,8 +208,7 @@ class AccountJWTAuthenticationTest extends TestCase ); // Wrong From - $reponse = $this - ->withHeaders(['From' => 'sip:missing@username']) + $this->withHeaders(['From' => 'sip:missing@username']) ->json($this->method, $this->routeAccountMe) ->assertStatus(401); @@ -220,8 +218,7 @@ class AccountJWTAuthenticationTest extends TestCase ); // Wrong bearer message - $reponse = $this - ->withHeaders([ + $this->withHeaders([ 'Authorization' => 'Bearer 1234' ]) ->json($this->method, $this->routeAccountMe) @@ -233,7 +230,7 @@ class AccountJWTAuthenticationTest extends TestCase ); } - private function checkToken(UnencryptedToken $token): void + protected function checkToken(UnencryptedToken $token): void { $this->withHeaders([ 'Authorization' => 'Bearer ' . $token->toString(),