瀏覽代碼

fixed login

Benjamin Harris 2 月之前
父節點
當前提交
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;
     }
 }