1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-24 00:35:59 +00:00
pixelfed/app/Http/Middleware/EmailVerificationCheck.php
2018-08-12 20:36:01 -06:00

27 lines
663 B
PHP

<?php
namespace App\Http\Middleware;
use Auth, Closure;
class EmailVerificationCheck
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if($request->user() &&
config('pixelfed.enforce_email_verification') &&
is_null($request->user()->email_verified_at) &&
!$request->is('i/verify-email', 'log*', 'i/confirm-email/*', 'settings/home')
) {
return redirect('/i/verify-email');
}
return $next($request);
}
}