mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +00:00
Add closed registration message instead of 403
This commit is contained in:
parent
368b79da5a
commit
9403749d9a
2 changed files with 43 additions and 5 deletions
|
@ -39,7 +39,6 @@ class RegisterController extends Controller
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->middleware('guest');
|
$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');
|
$view = config('pixelfed.open_registration') == true ? 'auth.register' : 'site.closed-registration';
|
||||||
if (false == $openRegistration) {
|
return view($view);
|
||||||
abort(403);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
14
resources/views/site/closed-registration.blade.php
Normal file
14
resources/views/site/closed-registration.blade.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<div class="error-page py-5 my-5">
|
||||||
|
<div class="card mx-5">
|
||||||
|
<div class="card-body p-5 text-center">
|
||||||
|
<h1>Registration is closed</h1>
|
||||||
|
<p class="lead mb-0">We have closed registrations on this instance.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
Loading…
Reference in a new issue