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