1
0
Fork 0
forked from mirror/pixelfed

Update UserInviteController, fixes #3017

This commit is contained in:
Daniel Supernault 2021-12-04 15:30:08 -07:00
parent 78b2650f3a
commit b8e9056ee3
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -9,19 +9,16 @@ use Illuminate\Support\Str;
class UserInviteController extends Controller class UserInviteController extends Controller
{ {
public function __construct()
{
abort_if(!config('pixelfed.user_invites.enabled'), 404);
}
public function create(Request $request) public function create(Request $request)
{ {
abort_if(!config('pixelfed.user_invites.enabled'), 404);
abort_unless(Auth::check(), 403); abort_unless(Auth::check(), 403);
return view('settings.invites.create'); return view('settings.invites.create');
} }
public function show(Request $request) public function show(Request $request)
{ {
abort_if(!config('pixelfed.user_invites.enabled'), 404);
abort_unless(Auth::check(), 403); abort_unless(Auth::check(), 403);
$invites = UserInvite::whereUserId(Auth::id())->paginate(10); $invites = UserInvite::whereUserId(Auth::id())->paginate(10);
$limit = config('pixelfed.user_invites.limit.total'); $limit = config('pixelfed.user_invites.limit.total');
@ -31,6 +28,7 @@ class UserInviteController extends Controller
public function store(Request $request) public function store(Request $request)
{ {
abort_if(!config('pixelfed.user_invites.enabled'), 404);
abort_unless(Auth::check(), 403); abort_unless(Auth::check(), 403);
$this->validate($request, [ $this->validate($request, [
'email' => 'required|email|unique:users|unique:user_invites', 'email' => 'required|email|unique:users|unique:user_invites',