Skip to content

Commit

Permalink
πŸš€ Feature - added ability to disable registrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen Melbourne committed Oct 7, 2019
1 parent 26f17c1 commit 77024c5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ DEBUGBAR_ENABLED=false
ENFORCE_DOMAIN=true

LOGIN_EMAIL=[email protected]
REGISTRATIONS_ENABLED=true
11 changes: 9 additions & 2 deletions app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Providers;

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;

Expand Down Expand Up @@ -52,8 +53,14 @@ public function map()
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
->namespace($this->namespace)
->group(function () {
Auth::routes([
'register' => config('auth.registrations_enabled'),
]);

include_once base_path('routes/web.php');
});
}

/**
Expand Down
5 changes: 5 additions & 0 deletions config/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

return [

/*
* You can disable the registration of the /register routes here.
*/
'registrations_enabled' => env('REGISTRATIONS_ENABLED', true),

/*
|--------------------------------------------------------------------------
| Authentication Defaults
Expand Down
6 changes: 4 additions & 2 deletions resources/views/auth/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@
</div>

<div class="mt-10">
<a class="inline-block" style="margin-bottom: 24px;" href="/register">Register</a> or
<a class="inline-block" style="margin-bottom: 24px;" href="/password/reset">Reset Password</a>
@if (Route::has('register'))
<a class="inline-block" style="margin-bottom: 24px;" href="{{ route('register') }}">Register</a> or
@endif
<a class="inline-block" style="margin-bottom: 24px;" href="{{ route('password.request') }}">Reset Password</a>
</div>
</form>

Expand Down
2 changes: 0 additions & 2 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
|
*/

Auth::routes();

Route::middleware('auth')->group(function () {
Route::redirect('/', '/websites')->name('home');
Route::get('edit-account', '\Maelstrom\Http\Controllers\EditAccountController')->name('maelstrom.edit-account');
Expand Down

0 comments on commit 77024c5

Please sign in to comment.