From 0a717f5ad50749996ae3f04214593d347d0e6353 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 9 Jul 2022 20:50:58 +1000 Subject: [PATCH] Verify hash --- app/Http/Middleware/VerifyHash.php | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 app/Http/Middleware/VerifyHash.php diff --git a/app/Http/Middleware/VerifyHash.php b/app/Http/Middleware/VerifyHash.php new file mode 100644 index 000000000000..f572221bac1f --- /dev/null +++ b/app/Http/Middleware/VerifyHash.php @@ -0,0 +1,37 @@ +has('payment_hash')){ + + $ph = PaymentHash::with('fee_invoice')->where('hash', $request->payment_hash)->first(); + + if($ph) + auth()->guard('contact')->loginUsingId($ph->fee_invoice->invitations->first()->contact->id, true); + + return $next($request); + + } + + abort(404, 'Unable to verify payment hash'); + } +}