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() &&
|
2022-12-09 10:55:06 +00:00
|
|
|
config('pixelfed.enforce_email_verification') &&
|
2021-05-12 01:59:24 +00:00
|
|
|
is_null($request->user()->email_verified_at) &&
|
|
|
|
!$request->is(
|
|
|
|
'i/auth/*',
|
2021-11-09 06:21:53 +00:00
|
|
|
'i/verify-email*',
|
2021-05-12 01:59:24 +00:00
|
|
|
'log*',
|
2021-06-13 06:37:54 +00:00
|
|
|
'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
|
|
|
}
|