Skip to content

Commit

Permalink
Merge pull request #10 from wouterdedroog/feature/add-disable-auth-op…
Browse files Browse the repository at this point in the history
…tion

Add registration option to env
  • Loading branch information
wouterdedroog authored Apr 25, 2024
2 parents 766143c + daee6d6 commit 8d12497
Show file tree
Hide file tree
Showing 10 changed files with 1,197 additions and 900 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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
tools: composer:v2

- name: Install dependencies
Expand Down
2,036 changes: 1,167 additions & 869 deletions composer.lock

Large diffs are not rendered by default.

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 8d12497

Please sign in to comment.