TDoG-Skin/app/Http/Middleware/EnsureEmailFilled.php

20 lines
424 B
PHP
Raw Normal View History

2024-08-17 18:43:48 +08:00
<?php
namespace App\Http\Middleware;
use Closure;
class EnsureEmailFilled
{
public function handle($request, Closure $next)
{
if ($request->user()->email != '' && $request->is('auth/bind')) {
return redirect('/user');
} elseif ($request->user()->email == '' && !$request->is('auth/bind')) {
return redirect('/auth/bind');
}
return $next($request);
}
}