From c4e77337a0408c1ff13a7ad1b2ff474ac8e1f3f2 Mon Sep 17 00:00:00 2001 From: Timot Tarjani Date: Thu, 12 Dec 2024 00:05:55 +0100 Subject: [PATCH 1/2] Fix CORS after Laravel upgrade --- config/cors.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cors.php b/config/cors.php index 738794b6b..31e08329e 100644 --- a/config/cors.php +++ b/config/cors.php @@ -19,7 +19,7 @@ 'allowed_methods' => ['*'], - 'allowed_origins' => [], + 'allowed_origins' => ['*'], 'allowed_origins_patterns' => [], From d753bc12ff5832f32b53d55bbc80c2f925b9b2e1 Mon Sep 17 00:00:00 2001 From: Timot Tarjani Date: Sun, 15 Dec 2024 17:40:35 +0100 Subject: [PATCH 2/2] Generate API Token on admin login --- app/Controllers/Auth/LoginController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Controllers/Auth/LoginController.php b/app/Controllers/Auth/LoginController.php index ff93f1eb1..6913ea2b1 100644 --- a/app/Controllers/Auth/LoginController.php +++ b/app/Controllers/Auth/LoginController.php @@ -5,6 +5,7 @@ use Illuminate\Routing\Controller; use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Http\Request; +use Illuminate\Support\Str; class LoginController extends Controller { @@ -66,7 +67,11 @@ public function showLoginForm() ]); } - + protected function authenticated(Request $request, $user) + { + $user->api_token = Str::random(60); + $user->save(); + } public function logout(Request $request) {