1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Verified users only for hosted platform

This commit is contained in:
David Bomba 2021-03-01 13:51:00 +11:00
parent d238d53b26
commit 9a2160c325

View File

@ -13,6 +13,7 @@ namespace App\Http\Middleware;
use App\Libraries\MultiDB;
use App\Models\User;
use App\Utils\Ninja;
use Closure;
use Hashids\Hashids;
use Illuminate\Http\Request;
@ -38,16 +39,14 @@ class UserVerified
*/
public function handle($request, Closure $next)
{
if(Ninja::isSelfHost())
return $next($request);
$error = [
'message' => 'Email confirmation required.',
'errors' => new \stdClass,
];
// nlog(auth()->user()->toArray());
// nlog($this->user->toArray());
// nlog((bool)$this->user->isVerified());
if ($this->user && !$this->user->isVerified())
return response()->json($error, 403);