Bubka 4 лет назад
Родитель
Сommit
06d5c62e8d

+ 8 - 8
app/Exceptions/Handler.php

@@ -2,7 +2,7 @@
 
 
 namespace App\Exceptions;
 namespace App\Exceptions;
 
 
-use Exception;
+use Throwable;
 use Illuminate\Http\Response;
 use Illuminate\Http\Response;
 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
 use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
 use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
@@ -33,10 +33,10 @@ class Handler extends ExceptionHandler
     /**
     /**
      * Report or log an exception.
      * Report or log an exception.
      *
      *
-     * @param  \Exception  $exception
+     * @param  \Throwable  $exception
      * @return void
      * @return void
      */
      */
-    public function report(Exception $exception)
+    public function report(Throwable $exception)
     {
     {
         parent::report($exception);
         parent::report($exception);
     }
     }
@@ -45,10 +45,10 @@ class Handler extends ExceptionHandler
      * Render an exception into an HTTP response.
      * Render an exception into an HTTP response.
      *
      *
      * @param  \Illuminate\Http\Request  $request
      * @param  \Illuminate\Http\Request  $request
-     * @param  \Exception  $exception
+     * @param  \Throwable  $exception
      * @return \Illuminate\Http\Response
      * @return \Illuminate\Http\Response
      */
      */
-    public function render($request, Exception $exception)
+    public function render($request, Throwable $exception)
     {        
     {        
         if ( $request->wantsJson() ) {
         if ( $request->wantsJson() ) {
 
 
@@ -65,10 +65,10 @@ class Handler extends ExceptionHandler
      * Render an exception into an HTTP response.
      * Render an exception into an HTTP response.
      *
      *
      * @param  \Illuminate\Http\Request  $request
      * @param  \Illuminate\Http\Request  $request
-     * @param  \Exception  $exception
+     * @param  \Throwable  $exception
      * @return \Illuminate\Http\JsonResponse
      * @return \Illuminate\Http\JsonResponse
      */
      */
-    private function handleApiException($request, Exception $exception)
+    private function handleApiException($request, Throwable $exception)
     {
     {
         $debug = [
         $debug = [
             'exception' => get_class($exception),
             'exception' => get_class($exception),
@@ -96,7 +96,7 @@ class Handler extends ExceptionHandler
     /**
     /**
      * Set a specific response payload for commons http error codes
      * Set a specific response payload for commons http error codes
      *
      *
-     * @param  \Exception  $exception
+     * @param  \Throwable  $exception
      * @return \Illuminate\Http\JsonResponse
      * @return \Illuminate\Http\JsonResponse
      */
      */
     private function customApiResponse($exception, $debug)
     private function customApiResponse($exception, $debug)

+ 3 - 1
app/Providers/AppServiceProvider.php

@@ -2,8 +2,10 @@
 
 
 namespace App\Providers;
 namespace App\Providers;
 
 
+use Illuminate\Support\Facades\Blade;
 use Illuminate\Support\ServiceProvider;
 use Illuminate\Support\ServiceProvider;
 
 
+
 class AppServiceProvider extends ServiceProvider
 class AppServiceProvider extends ServiceProvider
 {
 {
     /**
     /**
@@ -23,6 +25,6 @@ class AppServiceProvider extends ServiceProvider
      */
      */
     public function boot()
     public function boot()
     {
     {
-        //
+        Blade::withoutComponentTags();
     }
     }
 }
 }

+ 12 - 11
composer.json

@@ -8,22 +8,23 @@
     ],
     ],
     "license": "MIT",
     "license": "MIT",
     "require": {
     "require": {
-        "php": "^7.2",
-        "fideloper/proxy": "^4.0",
-        "laravel/framework": "6.*",
-        "laravel/tinker": "^2.0",
-        "laravel/passport": "^9.3.2",
+        "php": "^7.2.5",
+        "appstract/laravel-options": "^4.1.1",
         "doctrine/dbal": "^2.10",
         "doctrine/dbal": "^2.10",
-        "spatie/eloquent-sortable": "^3.9",
-        "spomky-labs/otphp": "^10.0",
+        "fideloper/proxy": "^4.2",
         "khanamiryan/qrcode-detector-decoder": "^1.0",
         "khanamiryan/qrcode-detector-decoder": "^1.0",
-        "appstract/laravel-options": "^3.0"
+        "laravel/framework": "^7.0",
+        "laravel/passport": "^9.3.2",
+        "laravel/tinker": "^2.0",
+        "laravel/ui": "^2.0",
+        "spatie/eloquent-sortable": "^3.9",
+        "spomky-labs/otphp": "^10.0"
     },
     },
     "require-dev": {
     "require-dev": {
-        "facade/ignition": "^1.4",
+        "facade/ignition": "^2.3",
         "fzaninotto/faker": "^1.9",
         "fzaninotto/faker": "^1.9",
-        "mockery/mockery": "^1.0",
-        "nunomaduro/collision": "^3.0",
+        "mockery/mockery": "^1.3",
+        "nunomaduro/collision": "^4.1",
         "phpunit/phpunit": "^9.3"
         "phpunit/phpunit": "^9.3"
     },
     },
     "config": {
     "config": {

Разница между файлами не показана из-за своего большого размера
+ 423 - 174
composer.lock


+ 52 - 78
config/mail.php

@@ -4,45 +4,73 @@ return [
 
 
     /*
     /*
     |--------------------------------------------------------------------------
     |--------------------------------------------------------------------------
-    | Mail Driver
+    | Default Mailer
     |--------------------------------------------------------------------------
     |--------------------------------------------------------------------------
     |
     |
-    | Laravel supports both SMTP and PHP's "mail" function as drivers for the
-    | sending of e-mail. You may specify which one you're using throughout
-    | your application here. By default, Laravel is setup for SMTP mail.
-    |
-    | Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
-    |            "sparkpost", "postmark", "log", "array"
+    | This option controls the default mailer that is used to send any email
+    | messages sent by your application. Alternative mailers may be setup
+    | and used as needed; however, this mailer will be used by default.
     |
     |
     */
     */
 
 
-    'driver' => env('MAIL_DRIVER', 'smtp'),
+    'default' => env('MAIL_MAILER', 'smtp'),
 
 
     /*
     /*
     |--------------------------------------------------------------------------
     |--------------------------------------------------------------------------
-    | SMTP Host Address
+    | Mailer Configurations
     |--------------------------------------------------------------------------
     |--------------------------------------------------------------------------
     |
     |
-    | Here you may provide the host address of the SMTP server used by your
-    | applications. A default option is provided that is compatible with
-    | the Mailgun mail service which will provide reliable deliveries.
+    | Here you may configure all of the mailers used by your application plus
+    | their respective settings. Several examples have been configured for
+    | you and you are free to add your own as your application requires.
     |
     |
-    */
-
-    'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | SMTP Host Port
-    |--------------------------------------------------------------------------
+    | Laravel supports a variety of mail "transport" drivers to be used while
+    | sending an e-mail. You will specify which one you are using for your
+    | mailers below. You are free to add additional mailers as required.
     |
     |
-    | This is the SMTP port used by your application to deliver e-mails to
-    | users of the application. Like the host we have set this value to
-    | stay compatible with the Mailgun e-mail application by default.
+    | Supported: "smtp", "sendmail", "mailgun", "ses",
+    |            "postmark", "log", "array"
     |
     |
     */
     */
 
 
-    'port' => env('MAIL_PORT', 587),
+    'mailers' => [
+        'smtp' => [
+            'transport' => 'smtp',
+            'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
+            'port' => env('MAIL_PORT', 587),
+            'encryption' => env('MAIL_ENCRYPTION', 'tls'),
+            'username' => env('MAIL_USERNAME'),
+            'password' => env('MAIL_PASSWORD'),
+            'timeout' => null,
+            'auth_mode' => null,
+        ],
+
+        'ses' => [
+            'transport' => 'ses',
+        ],
+
+        'mailgun' => [
+            'transport' => 'mailgun',
+        ],
+
+        'postmark' => [
+            'transport' => 'postmark',
+        ],
+
+        'sendmail' => [
+            'transport' => 'sendmail',
+            'path' => '/usr/sbin/sendmail -bs',
+        ],
+
+        'log' => [
+            'transport' => 'log',
+            'channel' => env('MAIL_LOG_CHANNEL'),
+        ],
+
+        'array' => [
+            'transport' => 'array',
+        ],
+    ],
 
 
     /*
     /*
     |--------------------------------------------------------------------------
     |--------------------------------------------------------------------------
@@ -60,47 +88,6 @@ return [
         'name' => env('MAIL_FROM_NAME', 'Example'),
         'name' => env('MAIL_FROM_NAME', 'Example'),
     ],
     ],
 
 
-    /*
-    |--------------------------------------------------------------------------
-    | E-Mail Encryption Protocol
-    |--------------------------------------------------------------------------
-    |
-    | Here you may specify the encryption protocol that should be used when
-    | the application send e-mail messages. A sensible default using the
-    | transport layer security protocol should provide great security.
-    |
-    */
-
-    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | SMTP Server Username
-    |--------------------------------------------------------------------------
-    |
-    | If your SMTP server requires a username for authentication, you should
-    | set it here. This will get used to authenticate with your server on
-    | connection. You may also set the "password" value below this one.
-    |
-    */
-
-    'username' => env('MAIL_USERNAME'),
-
-    'password' => env('MAIL_PASSWORD'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Sendmail System Path
-    |--------------------------------------------------------------------------
-    |
-    | When using the "sendmail" driver to send e-mails, we will need to know
-    | the path to where Sendmail lives on this server. A default path has
-    | been provided here, which will work well on most of your systems.
-    |
-    */
-
-    'sendmail' => '/usr/sbin/sendmail -bs',
-
     /*
     /*
     |--------------------------------------------------------------------------
     |--------------------------------------------------------------------------
     | Markdown Mail Settings
     | Markdown Mail Settings
@@ -120,17 +107,4 @@ return [
         ],
         ],
     ],
     ],
 
 
-    /*
-    |--------------------------------------------------------------------------
-    | Log Channel
-    |--------------------------------------------------------------------------
-    |
-    | If you are using the "log" driver, you may specify the logging channel
-    | if you prefer to keep mail messages separate from other log entries
-    | for simpler reading. Otherwise, the default channel will be used.
-    |
-    */
-
-    'log_channel' => env('MAIL_LOG_CHANNEL'),
-
 ];
 ];

+ 1 - 1
config/session.php

@@ -166,7 +166,7 @@ return [
     |
     |
     */
     */
 
 
-    'secure' => env('SESSION_SECURE_COOKIE', false),
+    'secure' => env('SESSION_SECURE_COOKIE', null),
 
 
     /*
     /*
     |--------------------------------------------------------------------------
     |--------------------------------------------------------------------------

+ 34 - 0
database/migrations/2020_10_11_202302_add_provider_column_to_oauth_clients_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddProviderColumnToOauthClientsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('oauth_clients', function (Blueprint $table) {
+            if (!Schema::hasColumn('oauth_clients', 'provider')) {
+                $table->string('provider')->after('secret')->nullable();
+            } 
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('oauth_clients', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 4 - 4
tests/Unit/TwoFAccountTest.php

@@ -44,7 +44,7 @@ class TwoFAccountTest extends TestCase
         $response = $this->actingAs($this->user, 'api')
         $response = $this->actingAs($this->user, 'api')
             ->json('GET', '/api/twofaccounts/' . $twofaccount->id)
             ->json('GET', '/api/twofaccounts/' . $twofaccount->id)
             ->assertStatus(200)
             ->assertStatus(200)
-            ->assertJson([
+            ->assertJsonFragment([
                 'service' => 'testTOTP',
                 'service' => 'testTOTP',
                 'account' => 'test@test.com',
                 'account' => 'test@test.com',
                 'uri' => 'otpauth://totp/test@test.com?secret=A4GRFHVVRBGY7UIW&issuer=test',
                 'uri' => 'otpauth://totp/test@test.com?secret=A4GRFHVVRBGY7UIW&issuer=test',
@@ -81,7 +81,7 @@ class TwoFAccountTest extends TestCase
                     'icon' => 'test.png',
                     'icon' => 'test.png',
                 ])
                 ])
             ->assertStatus(201)
             ->assertStatus(201)
-            ->assertJson([
+            ->assertJsonFragment([
                 'service' => 'testCreation',
                 'service' => 'testCreation',
                 'account' => 'test@example.org',
                 'account' => 'test@example.org',
                 'uri' => 'otpauth://totp/test@test.com?secret=A4GRFHZVRBGY7UIW&issuer=test',
                 'uri' => 'otpauth://totp/test@test.com?secret=A4GRFHZVRBGY7UIW&issuer=test',
@@ -182,7 +182,7 @@ class TwoFAccountTest extends TestCase
                     'icon' => 'testUpdate.png',
                     'icon' => 'testUpdate.png',
                 ])
                 ])
             ->assertStatus(200)
             ->assertStatus(200)
-            ->assertJson([
+            ->assertJsonFragment([
                 'id' => 1,
                 'id' => 1,
                 'service' => 'testUpdate',
                 'service' => 'testUpdate',
                 'account' => 'testUpdate@test.com',
                 'account' => 'testUpdate@test.com',
@@ -213,7 +213,7 @@ class TwoFAccountTest extends TestCase
                     'counter' => '5'
                     'counter' => '5'
                 ])
                 ])
             ->assertStatus(200)
             ->assertStatus(200)
-            ->assertJson([
+            ->assertJsonFragment([
                 'id' => 1,
                 'id' => 1,
                 'service' => 'testUpdate.com',
                 'service' => 'testUpdate.com',
                 'account' => 'testUpdate',
                 'account' => 'testUpdate',

Некоторые файлы не были показаны из-за большого количества измененных файлов