Run without login when OIDC isn't configured
With OIDC_ISSUER, OIDC_CLIENT_ID and OIDC_CLIENT_SECRET empty (or at the .env.example placeholders) Kaname needs no login. With all three set, OIDC works as before; only some set is an error. /api/v1 still requires tokens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1fe61142f4
commit
a13ac85f7c
14 files changed
+116
-41
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { auth, OIDC_PROVIDER_ID, signIn } from "@/auth";
|
||||
import { currentSession, OIDC_PROVIDER_ID, signIn } from "@/auth";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
|
||||
@@ -19,7 +19,8 @@ export default async function LoginPage({ searchParams }: PageProps<"/login">) {
|
||||
const params = await searchParams;
|
||||
const callbackUrl = safeCallback(params.callbackUrl);
|
||||
|
||||
if ((await auth())?.user) redirect(callbackUrl);
|
||||
// Also covers login off: currentSession() is never null then.
|
||||
if (await currentSession()) redirect(callbackUrl);
|
||||
|
||||
const errorKey = typeof params.error === "string" ? params.error : undefined;
|
||||
const error = errorKey ? (ERRORS[errorKey] ?? "Login failed. Please try again.") : undefined;
|
||||
|
||||
Reference in new issue
Block a user