Let user disable the signup (#56) (#81)

Updates the RegisterController to check if the signup is disabled.
Removes signup link if needed.
Also adds a new generic 403 error page.
This commit is contained in:
Kovah
2017-06-07 18:19:19 +02:00
committed by Régis Freyd
parent 9dcb6d0e1e
commit 3acdacc047
5 changed files with 49 additions and 1 deletions
@@ -44,6 +44,20 @@ class RegisterController extends Controller
$this->middleware('guest');
}
/**
* Show the application registration form.
*
* @return \Illuminate\Http\Response
*/
public function showRegistrationForm()
{
if (env('APP_DISABLE_SIGNUP') == 'true') {
abort(403, trans('auth.signup_disabled'));
}
return view('auth.register');
}
/**
* Get a validator for an incoming registration request.
*
@@ -113,6 +127,12 @@ class RegisterController extends Controller
$userObject = User::where('email', $user->getEmail())->first();
if (count($userObject) == 0) {
// Abort if signup is disabled
if (env('APP_DISABLE_SIGNUP') == 'true') {
abort(403);
}
$userObject = new User;
$userObject->first_name = 'Facebook';
$userObject->last_name = 'User';