Remove Spatie Ray - poor error handling

This commit is contained in:
David Bomba 2021-01-30 12:13:32 +11:00
parent 3c72a15707
commit 65ee07b8ec
4 changed files with 209 additions and 727 deletions

View File

@ -35,10 +35,10 @@ function nlog($output, $context = []): void
}
if (!function_exists('ray')) {
function ray($payload)
{
return true;
}
}
// if (!function_exists('ray')) {
// function ray($payload)
// {
// return true;
// }
// }

View File

@ -32,7 +32,9 @@ class InvitationController extends Controller
use MakesDates;
public function router(string $entity, string $invitation_key)
{
{
Auth::logout();
return $this->genericRouter($entity, $invitation_key);
}
@ -43,6 +45,7 @@ class InvitationController extends Controller
private function genericRouter(string $entity, string $invitation_key)
{
$key = $entity.'_id';
$entity_obj = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation';
@ -51,17 +54,24 @@ class InvitationController extends Controller
->with('contact.client')
->firstOrFail();
nlog($invitation->contact->client->id);
nlog($invitation->invoice->client_id);
/* Return early if we have the correct client_hash embedded */
if (request()->has('client_hash') && request()->input('client_hash') == $invitation->contact->client->client_hash) {
auth()->guard('contact')->login($invitation->contact, true);
} elseif ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
//If no contact password is set - this will cause a 401 error - instead redirect to the client.login route
$this->middleware('auth:contact');
return redirect()->route('client.login');
} else {
auth()->guard('contact')->login($invitation->contact, true);
}
if (auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) {
$invitation->markViewed();

View File

@ -79,7 +79,6 @@
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.0",
"spatie/laravel-ray": "^1.3",
"vimeo/psalm": "^4.0",
"wildbit/postmark-php": "^4.0"
},

909
composer.lock generated

File diff suppressed because it is too large Load Diff