From 261cdf39873af75265b25afeaf8681a29ec48afa Mon Sep 17 00:00:00 2001
From: Ulung32 <13521122@mahasiswa.itb.ac.id>
Date: Mon, 9 Oct 2023 11:11:26 +0700
Subject: [PATCH] fix redirect if not login

---
 src/App/controller/product/ProductController.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/App/controller/product/ProductController.php b/src/App/controller/product/ProductController.php
index d5940ac..eed8953 100644
--- a/src/App/controller/product/ProductController.php
+++ b/src/App/controller/product/ProductController.php
@@ -5,7 +5,9 @@
 class ProductController extends Controller{
     public function index($id){
         if($this->userRole !== 1) {
-            throw new Exception("You are not allowed to view this page", 405);
+            // throw new Exception("You are not allowed to view this page", 405);
+            header("Location: /login");
+            exit();
         }
         
         $productModel = $this->model("ProductModel");
-- 
GitLab