diff --git a/app/Http/Controllers/ParticipantController.php b/app/Http/Controllers/ParticipantController.php index a3d9323..3e5a528 100644 --- a/app/Http/Controllers/ParticipantController.php +++ b/app/Http/Controllers/ParticipantController.php @@ -10,7 +10,8 @@ class ParticipantController extends Controller { public static function createFromToken(Request $request, string $id) { - if ($request->input('password') !== 'password123') { + if ($request->input('password') !== env('ADMIN_PASSWORD')) { + Log::info(env('ADMIN_PASSWORD')); return response()->json(['message' => 'Unauthorized: Wrong password'], 401); } diff --git a/resources/views/livewire/pages/table.blade.php b/resources/views/livewire/pages/table.blade.php index b921f0e..374e0d0 100644 --- a/resources/views/livewire/pages/table.blade.php +++ b/resources/views/livewire/pages/table.blade.php @@ -5,9 +5,15 @@ use App\Services\MatcherService; use Illuminate\Database\Eloquent\Collection; use function Livewire\Volt\{state, mount}; -state(['participants' => Collection::class]); +state(['participants' => Collection::class, + 'render' => false]); +state(['password']); -mount(function () { +mount(function ($password) { + $this->password = $password; + if ($this->password == env('ADMIN_PASSWORD')) { + $this->render = true; + } $this->participants = Participant::all(); }); @@ -22,6 +28,7 @@ $runMatch = function () { ?>
+ @if($render)
@@ -102,4 +109,5 @@ $runMatch = function () {
@endif + @endif
diff --git a/routes/web.php b/routes/web.php index dd3f306..9ed0abe 100644 --- a/routes/web.php +++ b/routes/web.php @@ -8,6 +8,6 @@ Route::get('/', function () { })->name('home'); Volt::route('start', 'pages.start')->name('start'); -Volt::route('table', 'pages.table')->name('table'); +Volt::route('table/{password}', 'pages.table')->name('table'); Volt::route('profile/{token}', 'pages.profile')->name('profile'); Volt::route('withdraw/{token}', 'pages.withdraw')->name('withdraw');