mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-22 08:13:11 +01:00
Upgrade to Laravel 7.0
This commit is contained in:
parent
c653208706
commit
06d5c62e8d
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Throwable;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
|
||||
@ -33,10 +33,10 @@ class Handler extends ExceptionHandler
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param \Throwable $exception
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $exception)
|
||||
public function report(Throwable $exception)
|
||||
{
|
||||
parent::report($exception);
|
||||
}
|
||||
@ -45,10 +45,10 @@ public function report(Exception $exception)
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $exception
|
||||
* @param \Throwable $exception
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $exception)
|
||||
public function render($request, Throwable $exception)
|
||||
{
|
||||
if ( $request->wantsJson() ) {
|
||||
|
||||
@ -65,10 +65,10 @@ public function render($request, Exception $exception)
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $exception
|
||||
* @param \Throwable $exception
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
private function handleApiException($request, Exception $exception)
|
||||
private function handleApiException($request, Throwable $exception)
|
||||
{
|
||||
$debug = [
|
||||
'exception' => get_class($exception),
|
||||
@ -96,7 +96,7 @@ private function handleApiException($request, Exception $exception)
|
||||
/**
|
||||
* Set a specific response payload for commons http error codes
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param \Throwable $exception
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
private function customApiResponse($exception, $debug)
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
@ -23,6 +25,6 @@ public function register()
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
Blade::withoutComponentTags();
|
||||
}
|
||||
}
|
||||
|
@ -8,22 +8,23 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"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",
|
||||
"spatie/eloquent-sortable": "^3.9",
|
||||
"spomky-labs/otphp": "^10.0",
|
||||
"fideloper/proxy": "^4.2",
|
||||
"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": {
|
||||
"facade/ignition": "^1.4",
|
||||
"facade/ignition": "^2.3",
|
||||
"fzaninotto/faker": "^1.9",
|
||||
"mockery/mockery": "^1.0",
|
||||
"nunomaduro/collision": "^3.0",
|
||||
"mockery/mockery": "^1.3",
|
||||
"nunomaduro/collision": "^4.1",
|
||||
"phpunit/phpunit": "^9.3"
|
||||
},
|
||||
"config": {
|
||||
|
1197
composer.lock
generated
1197
composer.lock
generated
File diff suppressed because it is too large
Load Diff
130
config/mail.php
130
config/mail.php
@ -4,45 +4,73 @@
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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.
|
||||
|
|
||||
| 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.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses",
|
||||
| "postmark", "log", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||
'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,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SMTP Host Port
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 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.
|
||||
|
|
||||
*/
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'port' => env('MAIL_PORT', 587),
|
||||
'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 @@
|
||||
'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
|
||||
@ -120,17 +107,4 @@
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'),
|
||||
|
||||
];
|
||||
|
@ -166,7 +166,7 @@
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE', false),
|
||||
'secure' => env('SESSION_SECURE_COOKIE', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -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) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
@ -44,7 +44,7 @@ public function testTwoFAccountDisplay()
|
||||
$response = $this->actingAs($this->user, 'api')
|
||||
->json('GET', '/api/twofaccounts/' . $twofaccount->id)
|
||||
->assertStatus(200)
|
||||
->assertJson([
|
||||
->assertJsonFragment([
|
||||
'service' => 'testTOTP',
|
||||
'account' => 'test@test.com',
|
||||
'uri' => 'otpauth://totp/test@test.com?secret=A4GRFHVVRBGY7UIW&issuer=test',
|
||||
@ -81,7 +81,7 @@ public function testTwoFAccountCreation()
|
||||
'icon' => 'test.png',
|
||||
])
|
||||
->assertStatus(201)
|
||||
->assertJson([
|
||||
->assertJsonFragment([
|
||||
'service' => 'testCreation',
|
||||
'account' => 'test@example.org',
|
||||
'uri' => 'otpauth://totp/test@test.com?secret=A4GRFHZVRBGY7UIW&issuer=test',
|
||||
@ -182,7 +182,7 @@ public function testTwoFAccountTOTPUpdate()
|
||||
'icon' => 'testUpdate.png',
|
||||
])
|
||||
->assertStatus(200)
|
||||
->assertJson([
|
||||
->assertJsonFragment([
|
||||
'id' => 1,
|
||||
'service' => 'testUpdate',
|
||||
'account' => 'testUpdate@test.com',
|
||||
@ -213,7 +213,7 @@ public function testTwoFAccountHOTPUpdate()
|
||||
'counter' => '5'
|
||||
])
|
||||
->assertStatus(200)
|
||||
->assertJson([
|
||||
->assertJsonFragment([
|
||||
'id' => 1,
|
||||
'service' => 'testUpdate.com',
|
||||
'account' => 'testUpdate',
|
||||
|
Loading…
Reference in New Issue
Block a user