1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-25 01:05:36 +00:00
pixelfed/app/Http/Middleware/EmailVerificationCheck.php

36 lines
790 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
{
/**
* Handle an incoming request.
*
2018-08-28 03:07:36 +00:00
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
2018-06-14 05:30:43 +00:00
* @return mixed
*/
public function handle($request, Closure $next)
{
2018-08-28 03:07:36 +00:00
if ($request->user() &&
2018-06-14 05:30:43 +00:00
config('pixelfed.enforce_email_verification') &&
2018-08-28 03:07:36 +00:00
is_null($request->user()->email_verified_at) &&
!$request->is(
'i/verify-email',
'log*',
'i/confirm-email/*',
'settings/home',
'settings/email'
)
2018-06-14 05:30:43 +00:00
) {
return redirect('/i/verify-email');
2018-08-28 03:07:36 +00:00
}
2018-06-14 05:30:43 +00:00
return $next($request);
}
}