Benjamin Harris 2 сар өмнө
parent
commit
7da0516be4
1 өөрчлөгдсөн 3 нэмэгдсэн , 1 устгасан
  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;
     }
 }