From 5700da5323bf5ac965595037c6dc92fc88fd3ff5 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 22 Mar 2021 22:18:57 +1100 Subject: [PATCH] Fixes for password protection --- app/Http/Controllers/Auth/LoginController.php | 4 +++- app/PaymentDrivers/StripePaymentDriver.php | 9 +++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 288ce928e8e1..12cdb5ef6283 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -311,6 +311,8 @@ class LoginController extends BaseController Auth::login($existing_user, true); $existing_user->setCompany($existing_user->account->default_company); + $timeout = $existing_user->company()->default_password_timeout / 60000; + Cache::put($existing_user->hashed_id.'_logged_in', Str::random(64), $timeout); $cu = CompanyUser::query() ->where('user_id', auth()->user()->id); @@ -345,7 +347,7 @@ class LoginController extends BaseController auth()->user()->save(); $timeout = auth()->user()->company()->default_password_timeout / 60000; Cache::put(auth()->user()->hashed_id.'_logged_in', Str::random(64), $timeout); - + $ct = CompanyUser::whereUserId(auth()->user()->id); return $this->listResponse($ct); diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index f8bdf10c0f79..be95201d43e8 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -100,22 +100,19 @@ class StripePaymentDriver extends BaseDriver // GatewayType::APPLE_PAY, // TODO:: Missing implementation ]; - if ($this->company_gateway->getSofortEnabled() - && $this->client + if ($this->client && isset($this->client->country) && in_array($this->client->country->iso_3166_3, ['AUT', 'BEL', 'DEU', 'ITA', 'NLD', 'ESP'])) { $types[] = GatewayType::SOFORT; } - if ($this->company_gateway->getAchEnabled() - && $this->client + if ($this->client && isset($this->client->country) && in_array($this->client->country->iso_3166_3, ['USA'])) { $types[] = GatewayType::BANK_TRANSFER; } - if ($this->company_gateway->getAlipayEnabled() - && $this->client + if ($this->client && isset($this->client->country) && in_array($this->client->country->iso_3166_3, ['AUS', 'DNK', 'DEU', 'ITA', 'LUX', 'NOR', 'SVN', 'GBR', 'AUT', 'EST', 'GRC', 'JPN', 'MYS', 'PRT', 'ESP', 'USA', 'BEL', 'FIN', 'HKG', 'LVA', 'NLD', 'SGP', 'SWE', 'CAN', 'FRA', 'IRL', 'LTU', 'NZL', 'SVK', 'CHE'])) { $types[] = GatewayType::ALIPAY;