From 9403749d9a6b4ee04b047a620a393d8ce49facb7 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 20 Oct 2018 23:04:51 -0600 Subject: [PATCH] Add closed registration message instead of 403 --- .../Controllers/Auth/RegisterController.php | 34 ++++++++++++++++--- .../views/site/closed-registration.blade.php | 14 ++++++++ 2 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 resources/views/site/closed-registration.blade.php diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 11a3e805d..2fa15f11d 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -39,7 +39,6 @@ class RegisterController extends Controller public function __construct() { $this->middleware('guest'); - $this->openRegistrationCheck(); } /** @@ -105,11 +104,36 @@ class RegisterController extends Controller } } - public function openRegistrationCheck() + /** + * Show the application registration form. + * + * @return \Illuminate\Http\Response + */ + public function showRegistrationForm() { - $openRegistration = config('pixelfed.open_registration'); - if (false == $openRegistration) { - abort(403); + $view = config('pixelfed.open_registration') == true ? 'auth.register' : 'site.closed-registration'; + return view($view); + } + + /** + * Handle a registration request for the application. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function register(Request $request) + { + if(false == config('pixelfed.open_registration')) { + return abort(403); } + + $this->validator($request->all())->validate(); + + event(new Registered($user = $this->create($request->all()))); + + $this->guard()->login($user); + + return $this->registered($request, $user) + ?: redirect($this->redirectPath()); } } diff --git a/resources/views/site/closed-registration.blade.php b/resources/views/site/closed-registration.blade.php new file mode 100644 index 000000000..c3b10848e --- /dev/null +++ b/resources/views/site/closed-registration.blade.php @@ -0,0 +1,14 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+

Registration is closed

+

We have closed registrations on this instance.

+
+
+
+
+@endsection