1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

language is now persistent over whole flow + fixes

This commit is contained in:
paulwer 2023-12-20 17:58:06 +01:00
parent cb311c52f8
commit d7daca49d4
3 changed files with 6 additions and 10 deletions

View File

@ -17,12 +17,9 @@ use App\Http\Requests\Nordigen\ConfirmNordigenBankIntegrationRequest;
use App\Http\Requests\Nordigen\ConnectNordigenBankIntegrationRequest;
use App\Jobs\Bank\ProcessBankTransactionsNordigen;
use App\Models\BankIntegration;
use App\Models\Company;
use App\Models\User;
use App\Utils\Ninja;
use Cache;
use Illuminate\Http\Request;
use Log;
use Nordigen\NordigenPHP\Exceptions\NordigenExceptions\NordigenException;
class NordigenController extends BaseController
@ -36,6 +33,7 @@ class NordigenController extends BaseController
$data = $request->all();
$context = $request->getTokenContent();
$lang = $data['lang'] ?? 'en';
$context["lang"] = $lang;
if (!$context)
return view('bank.nordigen.handler', [
@ -136,6 +134,8 @@ class NordigenController extends BaseController
{
$data = $request->all();
$context = $request->getTokenContent();
if (!array_key_exists('lang', $data) && $context['lang'] != 'en')
return redirect()->route('nordigen.confirm', array_merge(["lang" => $context['lang']], $request->query())); // redirect is required in order for the bank-ui to display everything properly
$lang = $data['lang'] ?? 'en';
if (!$context || $context["context"] != "nordigen" || !array_key_exists("requisitionId", $context))

View File

@ -42,11 +42,9 @@ class ConfirmNordigenBankIntegrationRequest extends Request
}
public function getTokenContent()
{
if ($this->state) {
$this->token = $this->state;
}
$input = $this->all();
$data = Cache::get($this->token);
$data = Cache::get($input['ref']);
return $data;
}

View File

@ -14,9 +14,7 @@ namespace App\Http\Requests\Nordigen;
use App\Http\Requests\Request;
use App\Libraries\MultiDB;
use App\Models\Company;
use App\Models\User;
use Cache;
use Log;
class ConnectNordigenBankIntegrationRequest extends Request
{
@ -52,7 +50,7 @@ class ConnectNordigenBankIntegrationRequest extends Request
if (!array_key_exists('redirect', $input)) {
$context = $this->getTokenContent();
$input["redirect"] = isset($context["is_react"]) && $context['is_react'] ? redirect(config('ninja.react_url') . "/#/settings/bank_accounts") : redirect(config('ninja.app_url'));
$input["redirect"] = isset($context["is_react"]) && $context['is_react'] ? config('ninja.react_url') . "/#/settings/bank_accounts" : config('ninja.app_url');
$this->replace($input);
}