mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Merge pull request #5536 from turbo124/v5-develop
Delete migration directory after Import
This commit is contained in:
commit
3e66320d8b
@ -29,7 +29,6 @@ use App\Http\Middleware\QueryLogging;
|
||||
use App\Http\Middleware\RedirectIfAuthenticated;
|
||||
use App\Http\Middleware\SetDb;
|
||||
use App\Http\Middleware\SetDbByCompanyKey;
|
||||
use App\Http\Middleware\SetDefaultMailer;
|
||||
use App\Http\Middleware\SetDomainNameDb;
|
||||
use App\Http\Middleware\SetEmailDb;
|
||||
use App\Http\Middleware\SetInviteDb;
|
||||
@ -160,6 +159,5 @@ class Kernel extends HttpKernel
|
||||
'contact_key_login' => ContactKeyLogin::class,
|
||||
'check_client_existence' => CheckClientExistence::class,
|
||||
'user_verified' => UserVerified::class,
|
||||
'default_mailer' => SetDefaultMailer::class,
|
||||
];
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use stdClass;
|
||||
|
||||
class SetDefaultMailer
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
|
||||
config(['mail.default' => config('mail.default')]);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
@ -26,6 +26,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use ZipArchive;
|
||||
|
||||
class StartMigration implements ShouldQueue
|
||||
@ -110,6 +111,8 @@ class StartMigration implements ShouldQueue
|
||||
|
||||
Import::dispatchNow($file, $this->company, $this->user);
|
||||
|
||||
Storage::deleteDirectory(public_path("storage/migrations/{$filename}"));
|
||||
|
||||
} catch (NonExistingMigrationFile | ProcessingMigrationArchiveFailed | ResourceNotAvailableForMigration | MigrationValidatorFailed | ResourceDependencyMissing $e) {
|
||||
|
||||
Mail::to($this->user)->send(new MigrationFailed($e, $e->getMessage()));
|
||||
|
53
app/Listeners/Account/CreateAccountActivity.php
Normal file
53
app/Listeners/Account/CreateAccountActivity.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Listeners\Account;
|
||||
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Utils\Ninja;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class CreateAccountActivity implements ShouldQueue
|
||||
{
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @param ActivityRepository $activity_repo
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param object $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
if(Ninja::isHosted())
|
||||
{
|
||||
$nmo = new NinjaMailerObject;
|
||||
$nmo->mailable = new Modules\Admin\Mail\Welcome($event->user);
|
||||
$nmo->company = $event->company;
|
||||
$nmo->settings = $event->company->settings;
|
||||
$nmo->to_user = $event->user;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
}
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Events\Account\AccountCreated;
|
||||
use App\Events\Client\ClientWasArchived;
|
||||
use App\Events\Client\ClientWasCreated;
|
||||
use App\Events\Client\ClientWasDeleted;
|
||||
@ -179,6 +180,8 @@ class EventServiceProvider extends ServiceProvider
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
AccountCreated::class =>[
|
||||
],
|
||||
MessageSending::class =>[
|
||||
],
|
||||
MessageSent::class => [
|
||||
|
@ -13,12 +13,12 @@
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['middleware' => ['api_secret_check', 'default_mailer']], function () {
|
||||
Route::group(['middleware' => ['api_secret_check']], function () {
|
||||
Route::post('api/v1/signup', 'AccountController@store')->name('signup.submit');
|
||||
Route::post('api/v1/oauth_login', 'Auth\LoginController@oauthApiLogin');
|
||||
});
|
||||
|
||||
Route::group(['middleware' => ['api_secret_check', 'email_db', 'default_mailer']], function () {
|
||||
Route::group(['middleware' => ['api_secret_check', 'email_db']], function () {
|
||||
Route::post('api/v1/login', 'Auth\LoginController@apiLogin')->name('login.submit');
|
||||
Route::post('api/v1/reset_password', 'Auth\ForgotPasswordController@sendResetLinkEmail');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user