mirror of
https://github.com/kyantech/Palmr.git
synced 2025-11-02 13:03:15 +00:00
- Introduced the SECURE_SITE environment variable to control cookie security settings based on deployment context. - Updated Dockerfile to log SECURE_SITE status during application startup. - Enhanced documentation with a new guide on reverse proxy configuration, detailing the use of SECURE_SITE for secure cookie handling. - Adjusted authentication and email services to utilize SECURE_SITE for secure connections. - Updated frontend components to set cookie security based on the current protocol.
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
import { useRouter, useSearchParams } from "next/navigation";
|
|
import Cookies from "js-cookie";
|
|
|
|
export default function AuthCallbackPage() {
|
|
const searchParams = useSearchParams();
|
|
const router = useRouter();
|
|
|
|
useEffect(() => {
|
|
const token = searchParams.get("token");
|
|
|
|
if (token) {
|
|
Cookies.set("token", token, {
|
|
path: "/",
|
|
secure: window.location.protocol === "https:",
|
|
sameSite: window.location.protocol === "https:" ? "lax" : "strict",
|
|
httpOnly: false,
|
|
});
|
|
|
|
window.history.replaceState({}, document.title, window.location.pathname);
|
|
|
|
router.replace("/dashboard");
|
|
} else {
|
|
router.replace("/login");
|
|
}
|
|
}, [searchParams, router]);
|
|
|
|
return (
|
|
<div className="flex items-center justify-center min-h-screen">
|
|
<div className="text-center">
|
|
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto"></div>
|
|
<p className="mt-4 text-gray-600">Completing authentication...</p>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|