mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Verify hash
This commit is contained in:
parent
1d4e68938e
commit
0a717f5ad5
37
app/Http/Middleware/VerifyHash.php
Normal file
37
app/Http/Middleware/VerifyHash.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Models\Account;
|
||||
use App\Models\Company;
|
||||
use App\Models\PaymentHash;
|
||||
use App\Utils\Ninja;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class VerifyHash
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
|
||||
if($request->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');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user