pixelfed/app/Http/Middleware/EmailVerificationCheck.php

38 lines
660 B
PHP
Raw Normal View History

2018-06-14 05:30:43 +00:00
<?php
namespace App\Http\Middleware;
2018-08-28 03:07:36 +00:00
use Closure;
2018-06-14 05:30:43 +00:00
class EmailVerificationCheck
{
2021-05-12 01:59:24 +00:00
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($request->user() &&
config_cache('pixelfed.enforce_email_verification') &&
is_null($request->user()->email_verified_at) &&
!$request->is(
'i/auth/*',
'i/verify-email',
'log*',
'site*',
2021-05-12 01:59:24 +00:00
'i/confirm-email/*',
'settings/home',
'settings/email'
)
) {
return redirect('/i/verify-email');
}
2018-08-28 03:07:36 +00:00
2021-05-12 01:59:24 +00:00
return $next($request);
}
2018-06-14 05:30:43 +00:00
}