mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-01 20:17:35 -04:00 
			
		
		
		
	Enforce company locale
This commit is contained in:
		
							parent
							
								
									7fd1446f43
								
							
						
					
					
						commit
						3af749bdb0
					
				| @ -12,6 +12,7 @@ | ||||
| namespace App\Http\Middleware; | ||||
| 
 | ||||
| use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; | ||||
| use Illuminate\Session\TokenMismatchException; | ||||
| 
 | ||||
| class VerifyCsrfToken extends Middleware | ||||
| { | ||||
| @ -30,4 +31,17 @@ class VerifyCsrfToken extends Middleware | ||||
|     protected $except = [ | ||||
|         // 'livewire/message/*'
 | ||||
|     ]; | ||||
| 
 | ||||
| 
 | ||||
|     public function handle($request, \Closure $next) { | ||||
| 
 | ||||
|         try { | ||||
|             return parent::handle($request, $next); | ||||
|         } catch (TokenMismatchException $ex) { | ||||
| 
 | ||||
|             throw new TokenMismatchException('CSRF token mismatch.'); | ||||
| 
 | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -16,6 +16,7 @@ use Illuminate\Bus\Queueable; | ||||
| use Illuminate\Contracts\Queue\ShouldQueue; | ||||
| use Illuminate\Mail\Mailable; | ||||
| use Illuminate\Queue\SerializesModels; | ||||
| use Illuminate\Support\Facades\App; | ||||
| 
 | ||||
| class BouncedEmail extends Mailable  | ||||
| { | ||||
| @ -34,9 +35,11 @@ class BouncedEmail extends Mailable | ||||
|      */ | ||||
|     public function build() | ||||
|     { | ||||
|         App::setLocale($this->invitation->company->getLocale()); | ||||
| 
 | ||||
|         $entity_type = class_basename(lcfirst($this->invitation->getEntityType())); | ||||
| 
 | ||||
|         $subject = ctrans("texts.notification_{$entity_type}_bounced_subject", ['invoice' => $invoice->number]); | ||||
|         $subject = ctrans("texts.notification_{$entity_type}_bounced_subject", ['invoice' => $this->invitation->invoice->number]); | ||||
|          | ||||
|         return | ||||
|             $this->from(config('mail.from.address'), config('mail.from.name')) | ||||
|  | ||||
| @ -15,6 +15,7 @@ namespace App\Mail\Company; | ||||
| use Illuminate\Bus\Queueable; | ||||
| use Illuminate\Mail\Mailable; | ||||
| use Illuminate\Queue\SerializesModels; | ||||
| use Illuminate\Support\Facades\App; | ||||
| 
 | ||||
| class CompanyDeleted extends Mailable | ||||
| { | ||||
| @ -47,6 +48,8 @@ class CompanyDeleted extends Mailable | ||||
|      */ | ||||
|     public function build() | ||||
|     { | ||||
|         App::setLocale($this->company->getLocale()); | ||||
| 
 | ||||
|         return $this->from(config('mail.from.address'), config('mail.from.name')) | ||||
|             ->subject(ctrans('texts.company_deleted')) | ||||
|             ->view('email.admin.company_deleted') | ||||
|  | ||||
| @ -18,6 +18,7 @@ use Illuminate\Bus\Queueable; | ||||
| use Illuminate\Contracts\Queue\ShouldQueue; | ||||
| use Illuminate\Mail\Mailable; | ||||
| use Illuminate\Queue\SerializesModels; | ||||
| use Illuminate\Support\Facades\App; | ||||
| 
 | ||||
| class ContactPasswordlessLogin extends Mailable | ||||
| { | ||||
| @ -52,6 +53,9 @@ class ContactPasswordlessLogin extends Mailable | ||||
|      */ | ||||
|     public function build() | ||||
|     { | ||||
|          | ||||
|         App::setLocale($this->company->getLocale()); | ||||
| 
 | ||||
|         return $this | ||||
|             ->subject(ctrans('texts.account_passwordless_login')) | ||||
|             ->view('email.billing.passwordless-login', [ | ||||
|  | ||||
| @ -6,6 +6,7 @@ use App\Models\Company; | ||||
| use Illuminate\Bus\Queueable; | ||||
| use Illuminate\Mail\Mailable; | ||||
| use Illuminate\Queue\SerializesModels; | ||||
| use Illuminate\Support\Facades\App; | ||||
| 
 | ||||
| class DownloadInvoices extends Mailable | ||||
| { | ||||
| @ -27,6 +28,9 @@ class DownloadInvoices extends Mailable | ||||
|      */ | ||||
|     public function build() | ||||
|     { | ||||
| 
 | ||||
|         App::setLocale($this->company->getLocale()); | ||||
| 
 | ||||
|         return $this->from(config('mail.from.address'), config('mail.from.name')) | ||||
|             ->subject(ctrans('texts.download_files')) | ||||
|             ->view('email.admin.download_invoices', [ | ||||
|  | ||||
| @ -45,6 +45,7 @@ class CreditEmailEngine extends BaseEmailEngine | ||||
|     public function build() | ||||
|     { | ||||
|         App::forgetInstance('translator'); | ||||
|          | ||||
|         $t = app('translator'); | ||||
|         $t->replace(Ninja::transformTranslations($this->client->getMergedSettings())); | ||||
|          | ||||
|  | ||||
| @ -15,6 +15,7 @@ namespace App\Mail\Gateways; | ||||
| use App\Models\Company; | ||||
| use Illuminate\Mail\Mailable; | ||||
| use Illuminate\Queue\SerializesModels; | ||||
| use Illuminate\Support\Facades\App; | ||||
| 
 | ||||
| class ACHVerificationNotification extends Mailable | ||||
| { | ||||
| @ -49,6 +50,8 @@ class ACHVerificationNotification extends Mailable | ||||
|      */ | ||||
|     public function build() | ||||
|     { | ||||
|         App::setLocale($this->company->getLocale()); | ||||
| 
 | ||||
|         return $this | ||||
|             ->subject(ctrans('texts.ach_verification_notification_label')) | ||||
|             ->view('email.gateways.ach-verification-notification', [ | ||||
|  | ||||
| @ -14,6 +14,7 @@ namespace App\Mail\Import; | ||||
| use Illuminate\Bus\Queueable; | ||||
| use Illuminate\Mail\Mailable; | ||||
| use Illuminate\Queue\SerializesModels; | ||||
| use Illuminate\Support\Facades\App; | ||||
| 
 | ||||
| class CompanyImportFailure extends Mailable | ||||
| { | ||||
| @ -51,6 +52,8 @@ class CompanyImportFailure extends Mailable | ||||
|      */ | ||||
|     public function build() | ||||
|     { | ||||
|         App::setLocale($this->company->getLocale()); | ||||
| 
 | ||||
|         $this->settings = $this->company->settings; | ||||
|         $this->logo = $this->company->present()->logo(); | ||||
|         $this->title = ctrans('texts.company_import_failure_subject', ['company' => $this->company->present()->name()]); | ||||
|  | ||||
| @ -14,6 +14,7 @@ namespace App\Mail\Migration; | ||||
| use Illuminate\Bus\Queueable; | ||||
| use Illuminate\Mail\Mailable; | ||||
| use Illuminate\Queue\SerializesModels; | ||||
| use Illuminate\Support\Facades\App; | ||||
| 
 | ||||
| class MaxCompanies extends Mailable | ||||
| { | ||||
| @ -48,6 +49,8 @@ class MaxCompanies extends Mailable | ||||
|      */ | ||||
|     public function build() | ||||
|     { | ||||
|         App::setLocale($this->company->getLocale()); | ||||
| 
 | ||||
|         $this->settings = $this->company->settings; | ||||
|         $this->logo = $this->company->present()->logo(); | ||||
|         $this->title = ctrans('texts.max_companies'); | ||||
|  | ||||
| @ -14,6 +14,7 @@ namespace App\Mail\Migration; | ||||
| use Illuminate\Bus\Queueable; | ||||
| use Illuminate\Mail\Mailable; | ||||
| use Illuminate\Queue\SerializesModels; | ||||
| use Illuminate\Support\Facades\App; | ||||
| 
 | ||||
| class StripeConnectMigration extends Mailable | ||||
| { | ||||
| @ -44,6 +45,8 @@ class StripeConnectMigration extends Mailable | ||||
|      */ | ||||
|     public function build() | ||||
|     { | ||||
|         App::setLocale($this->company->getLocale()); | ||||
| 
 | ||||
|         $this->settings = $this->company->settings; | ||||
|         $this->logo = $this->company->present()->logo(); | ||||
|         $this->whitelabel = $this->company->account->isPaid(); | ||||
|  | ||||
| @ -14,6 +14,7 @@ namespace App\Mail\Ninja; | ||||
| use Illuminate\Bus\Queueable; | ||||
| use Illuminate\Mail\Mailable; | ||||
| use Illuminate\Queue\SerializesModels; | ||||
| use Illuminate\Support\Facades\App; | ||||
| 
 | ||||
| class EmailQuotaExceeded extends Mailable | ||||
| { | ||||
| @ -47,6 +48,8 @@ class EmailQuotaExceeded extends Mailable | ||||
|      */ | ||||
|     public function build() | ||||
|     { | ||||
|         App::setLocale($this->company->getLocale()); | ||||
| 
 | ||||
|         $this->settings = $this->company->settings; | ||||
|         $this->logo = $this->company->present()->logo(); | ||||
|         $this->title = ctrans('texts.email_quota_exceeded_subject'); | ||||
|  | ||||
| @ -37,6 +37,8 @@ class ClientContactRequestCancellationObject | ||||
|     { | ||||
| 
 | ||||
|         App::forgetInstance('translator'); | ||||
|         App::setLocale($this->company->getLocale()); | ||||
| 
 | ||||
|         $t = app('translator'); | ||||
|         $t->replace(Ninja::transformTranslations($this->company->settings)); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user