소스 검색

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;
     }
 }