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 () { ?>