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') +
We have closed registrations on this instance.
+