From 700ba00c211d34f48e35ce32a33b43b82b8114e7 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 14 Nov 2022 11:08:13 +1100 Subject: [PATCH 1/6] Flip the request requirements --- app/Http/Requests/Account/UpdateAccountRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Requests/Account/UpdateAccountRequest.php b/app/Http/Requests/Account/UpdateAccountRequest.php index 1ac2534ea6..1a64e626e7 100644 --- a/app/Http/Requests/Account/UpdateAccountRequest.php +++ b/app/Http/Requests/Account/UpdateAccountRequest.php @@ -26,7 +26,7 @@ class UpdateAccountRequest extends Request */ public function authorize() { - return (auth()->user()->isAdmin() || auth()->user()->isOwner()) && ($this->account->id == auth()->user()->account_id); + return (auth()->user()->isAdmin() || auth()->user()->isOwner()) && ($this->account->id == auth()->user()->token()->account_id); } /** From ccac01bacd95e16823f02c2dfc48ac9c72bc2adf Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 14 Nov 2022 12:02:52 +1100 Subject: [PATCH 2/6] Save default terms/footers --- app/Services/Invoice/TriggeredActions.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/Services/Invoice/TriggeredActions.php b/app/Services/Invoice/TriggeredActions.php index 76d9a0623a..5f52483ad0 100644 --- a/app/Services/Invoice/TriggeredActions.php +++ b/app/Services/Invoice/TriggeredActions.php @@ -67,6 +67,22 @@ class TriggeredActions extends AbstractService $this->updated = false; } + if($this->request->has('save_default_footer') && $this->request->input('save_default_footer') == 'true') { + $company = $this->invoice->company; + $settings = $company->settings; + $settings->invoice_footer = $this->invoice->footer; + $company->settings = $settings; + $company->save(); + } + + if($this->request->has('save_default_terms') && $this->request->input('save_default_terms') == 'true') { + $company = $this->invoice->company; + $settings = $company->settings; + $settings->invoice_terms = $this->invoice->terms; + $company->settings = $settings; + $company->save(); + } + if($this->updated) event('eloquent.updated: App\Models\Invoice', $this->invoice); From 5b5213de9323286be8ae0f4aff3b3adbf7bb9d5b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 14 Nov 2022 15:01:55 +1100 Subject: [PATCH 3/6] Allow different mail from / mail name for multi company mailers --- app/Jobs/Mail/NinjaMailerJob.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index 071e4106a4..9f1674055b 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -251,6 +251,13 @@ class NinjaMailerJob implements ShouldQueue ], ]); + if(env($this->company->id . '_MAIL_FROM_ADDRESS')) + { + $this->nmo + ->mailable + ->from(env($this->company->id . '_MAIL_FROM_ADDRESS', env('MAIL_FROM_ADDRESS')), env($this->company->id . '_MAIL_FROM_NAME', env('MAIL_FROM_NAME'))); + } + } } From 53f38d8cb71af65150d918b85b652bbc787e053e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 15 Nov 2022 07:23:14 +1100 Subject: [PATCH 4/6] Handle Cancellation Webhook Event --- app/Services/Invoice/HandleCancellation.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Services/Invoice/HandleCancellation.php b/app/Services/Invoice/HandleCancellation.php index 76b7545229..903c5edec4 100644 --- a/app/Services/Invoice/HandleCancellation.php +++ b/app/Services/Invoice/HandleCancellation.php @@ -57,6 +57,8 @@ class HandleCancellation extends AbstractService event(new InvoiceWasCancelled($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); + event('eloquent.updated: App\Models\Invoice', $this->invoice); + $transaction = [ 'invoice' => $this->invoice->transaction_event(), 'payment' => [], From 98e920a518a6971fc538e01dbf111319dc7ed6ae Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 15 Nov 2022 07:40:32 +1100 Subject: [PATCH 5/6] update lists --- app/Http/ValidationRules/Account/BlackListRule.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/ValidationRules/Account/BlackListRule.php b/app/Http/ValidationRules/Account/BlackListRule.php index 1735708800..a612808e25 100644 --- a/app/Http/ValidationRules/Account/BlackListRule.php +++ b/app/Http/ValidationRules/Account/BlackListRule.php @@ -27,6 +27,7 @@ class BlackListRule implements Rule 'superhostforumla.com', 'wnpop.com', 'dataservices.space', + 'karenkey.com', ]; /** From d58de8e02c897ff94bf78fee7ac3f5d286cfcc24 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 15 Nov 2022 13:35:24 +1100 Subject: [PATCH 6/6] patch for 2FA Verification --- app/Http/Controllers/TwilioController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/TwilioController.php b/app/Http/Controllers/TwilioController.php index 2baddfa239..1968edcfc5 100644 --- a/app/Http/Controllers/TwilioController.php +++ b/app/Http/Controllers/TwilioController.php @@ -165,8 +165,11 @@ class TwilioController extends BaseController if($verification_check->status == 'approved'){ - if($request->query('validate_only') == 'true') + if($request->query('validate_only') == 'true'){ + $user->verified_phone_number = true; + $user->save(); return response()->json(['message' => 'SMS verified'], 200); + } $user->google_2fa_secret = ''; $user->sms_verification_code = '';