Handle edge case where removed user tries to log into the system

This commit is contained in:
David Bomba 2022-05-04 08:35:36 +10:00
parent d9ec77003d
commit 352a1fc1c0
2 changed files with 3 additions and 32 deletions

View File

@ -217,6 +217,9 @@ class LoginController extends BaseController
$cu = CompanyUser::query() $cu = CompanyUser::query()
->where('user_id', auth()->user()->id); ->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 = app()->make(TruthSource::class);
$truth->setCompanyUser($cu->first()); $truth->setCompanyUser($cu->first());

View File

@ -43,38 +43,6 @@ class InvoiceInvitation extends BaseModel
return self::class; 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() public function entityType()
{ {
return Invoice::class; return Invoice::class;