1
0
Fork 0
pixelfed/app/Http/Middleware/EmailVerificationCheck.php

38 lines
655 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() &&
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*',
'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
}