Browse Source

fixed login

Benjamin Harris 2 tháng trước cách đây
mục cha
commit
7da0516be4
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      lib/auth.php

+ 3 - 1
lib/auth.php

@@ -39,7 +39,9 @@ function getCurrentUser(): ?array
 function requireLogin(): void
 {
     if (!isLoggedIn()) {
-        header('Location: /login/login.php');
+        $current  = $_SERVER['REQUEST_URI'] ?? '';
+        $redirect = $current !== '' ? '?redirect=' . urlencode($current) : '';
+        header('Location: /login/login.php' . $redirect);
         exit;
     }
 }