Skip to content

Commit

Permalink
Add option to disable registration
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterdedroog committed Apr 25, 2024
1 parent acf2130 commit 0469c02
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

YUBICO_CLIENT_ID=
YUBICO_SECRET_KEY=

UPDAT3R_REGISTRATION_ENABLED=true
7 changes: 7 additions & 0 deletions config/updat3r.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

return [

'registration_enabled' => env('UPDAT3R_REGISTRATION_ENABLED', true),

];
4 changes: 3 additions & 1 deletion resources/views/auth/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
@endsection

@section('switch-button')
<a href="/register" class="footer-link">Register</a>
@if(Route::has('register'))
<a href="/register" class="footer-link">Register</a>
@endif
@endsection
4 changes: 2 additions & 2 deletions resources/views/dashboard/documentation.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
</div>
<div class="codeheader" id="codeheader_java">(Java) Using {{ config('app.name', 'Updat3r') }} for your
Minecraft plugin</div>
<script src="https://gist.github.com/MrWouterNL/a0a7ec20fcc0df157fc8290ec6055cba.js"></script>
<script src="https://gist.github.com/wouterdedroog/a0a7ec20fcc0df157fc8290ec6055cba.js"></script>
</div>
</div>
</div>
</div>
@endsection
@endsection
3 changes: 1 addition & 2 deletions resources/views/layouts/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ class="user-avatar-md rounded-circle"></a>
<div class="footer">
<div class="row">
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
Copyright © 2020 MrWouter. All rights reserved. Design by <a
href="https://colorlib.com/wp/">Colorlib</a>.
Design by <a href="https://colorlib.com/wp/">Colorlib</a>.
</div>
</div>
</div>
Expand Down
6 changes: 5 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
|
*/

Auth::routes();
Auth::routes([
// enable registration and password reset only if registration is enabled
'register' => config('updat3r.registration_enabled'),
'reset' => config('updat3r.registration_enabled')
]);

Route::view('/about', 'about');

Expand Down
24 changes: 0 additions & 24 deletions tests/Feature/RegistrationTest.php

This file was deleted.

9 changes: 9 additions & 0 deletions tests/Unit/AuthEnabledTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

use Illuminate\Support\Facades\Route;

test('the registration and password reset routes are disabled.')
->skip(fn() => config('updat3r.registration_enabled'), 'Registration is currently enabled')
->expect(fn($route) => Route::has($route))
->toBeFalse()
->with(['register', 'password.request', 'password.reset']);

0 comments on commit 0469c02

Please sign in to comment.