mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-27 11:43:43 +00:00
Compare commits
2 Commits
1.16.0-s.0
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d63a15715 | ||
|
|
fa2e229ada |
@@ -3,11 +3,12 @@ import { redirect } from "next/navigation";
|
|||||||
import DeviceLoginForm from "@/components/DeviceLoginForm";
|
import DeviceLoginForm from "@/components/DeviceLoginForm";
|
||||||
import { getUserDisplayName } from "@app/lib/getUserDisplayName";
|
import { getUserDisplayName } from "@app/lib/getUserDisplayName";
|
||||||
import { cache } from "react";
|
import { cache } from "react";
|
||||||
|
import { cleanRedirect } from "@app/lib/cleanRedirect";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
searchParams: Promise<{ code?: string; user?: string }>;
|
searchParams: Promise<{ code?: string; user?: string; authPath?: string }>;
|
||||||
};
|
};
|
||||||
|
|
||||||
function deviceRedirectSearchParams(params: {
|
function deviceRedirectSearchParams(params: {
|
||||||
@@ -30,11 +31,11 @@ export default async function DeviceLoginPage({ searchParams }: Props) {
|
|||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
const redirectDestination = `/auth/login/device${deviceRedirectSearchParams({ code, user: params.user })}`;
|
const redirectDestination = `/auth/login/device${deviceRedirectSearchParams({ code, user: params.user })}`;
|
||||||
const loginUrl = new URL("/auth/login", "http://x");
|
const authPath = cleanRedirect(params.authPath || "/auth/login");
|
||||||
|
const loginUrl = new URL(authPath, "http://x");
|
||||||
loginUrl.searchParams.set("forceLogin", "true");
|
loginUrl.searchParams.set("forceLogin", "true");
|
||||||
loginUrl.searchParams.set("redirect", redirectDestination);
|
loginUrl.searchParams.set("redirect", redirectDestination);
|
||||||
if (defaultUser) loginUrl.searchParams.set("user", defaultUser);
|
if (defaultUser) loginUrl.searchParams.set("user", defaultUser);
|
||||||
console.log("loginUrl", loginUrl.pathname + loginUrl.search);
|
|
||||||
redirect(loginUrl.pathname + loginUrl.search);
|
redirect(loginUrl.pathname + loginUrl.search);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user