From 352a1fc1c0af5887bb8d662bf4d5da8915f0a779 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 4 May 2022 08:35:36 +1000 Subject: [PATCH] Handle edge case where removed user tries to log into the system --- app/Http/Controllers/Auth/LoginController.php | 3 ++ app/Models/InvoiceInvitation.php | 32 ------------------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index bf57f96ae966..42959015863b 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -217,6 +217,9 @@ class LoginController extends BaseController $cu = CompanyUser::query() ->where('user_id', auth()->user()->id); + if($cu->count() == 0) + return response()->json(['message' => 'User found, but not attached to any companies, please see your administrator'], 400); + $truth = app()->make(TruthSource::class); $truth->setCompanyUser($cu->first()); diff --git a/app/Models/InvoiceInvitation.php b/app/Models/InvoiceInvitation.php index 21ccce4c2e0b..062e02a47a56 100644 --- a/app/Models/InvoiceInvitation.php +++ b/app/Models/InvoiceInvitation.php @@ -43,38 +43,6 @@ class InvoiceInvitation extends BaseModel return self::class; } - // public function getSignatureDateAttribute($value) - // { - // if (!$value) { - // return (new Carbon($value))->format('Y-m-d'); - // } - // return $value; - // } - - // public function getSentDateAttribute($value) - // { - // if (!$value) { - // return (new Carbon($value))->format('Y-m-d'); - // } - // return $value; - // } - - // public function getViewedDateAttribute($value) - // { - // if (!$value) { - // return (new Carbon($value))->format('Y-m-d'); - // } - // return $value; - // } - - // public function getOpenedDateAttribute($value) - // { - // if (!$value) { - // return (new Carbon($value))->format('Y-m-d'); - // } - // return $value; - // } - public function entityType() { return Invoice::class;