mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 17:57:33 +00:00
lint: cleanup login
This commit is contained in:
@@ -33,7 +33,6 @@ export default async function Page(props: {
|
|||||||
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
||||||
}) {
|
}) {
|
||||||
const searchParams = await props.searchParams;
|
const searchParams = await props.searchParams;
|
||||||
// const locale = getLocale();
|
|
||||||
|
|
||||||
const requestId = searchParams?.requestId;
|
const requestId = searchParams?.requestId;
|
||||||
const organization = searchParams?.organization;
|
const organization = searchParams?.organization;
|
||||||
|
@@ -26,7 +26,6 @@ export default async function Page(props: {
|
|||||||
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
||||||
}) {
|
}) {
|
||||||
const searchParams = await props.searchParams;
|
const searchParams = await props.searchParams;
|
||||||
// const locale = getLocale();
|
|
||||||
|
|
||||||
const { loginName, requestId, organization, sessionId } = searchParams;
|
const { loginName, requestId, organization, sessionId } = searchParams;
|
||||||
|
|
||||||
|
@@ -11,7 +11,6 @@ import {
|
|||||||
getLoginSettings,
|
getLoginSettings,
|
||||||
getSession,
|
getSession,
|
||||||
} from "@/lib/zitadel";
|
} from "@/lib/zitadel";
|
||||||
import { getLocale } from "next-intl/server";
|
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
|
|
||||||
export default async function Page(props: {
|
export default async function Page(props: {
|
||||||
@@ -20,7 +19,6 @@ export default async function Page(props: {
|
|||||||
}) {
|
}) {
|
||||||
const params = await props.params;
|
const params = await props.params;
|
||||||
const searchParams = await props.searchParams;
|
const searchParams = await props.searchParams;
|
||||||
const locale = getLocale();
|
|
||||||
|
|
||||||
const _headers = await headers();
|
const _headers = await headers();
|
||||||
const { serviceUrl } = getServiceUrlFromHeaders(_headers);
|
const { serviceUrl } = getServiceUrlFromHeaders(_headers);
|
||||||
|
@@ -13,7 +13,7 @@ export default async function Page(props: {
|
|||||||
}) {
|
}) {
|
||||||
const searchParams = await props.searchParams;
|
const searchParams = await props.searchParams;
|
||||||
|
|
||||||
const { loginName, prompt, organization, requestId, userId } = searchParams;
|
const { loginName, prompt, organization, requestId } = searchParams;
|
||||||
|
|
||||||
const _headers = await headers();
|
const _headers = await headers();
|
||||||
const { serviceUrl } = getServiceUrlFromHeaders(_headers);
|
const { serviceUrl } = getServiceUrlFromHeaders(_headers);
|
||||||
|
@@ -13,14 +13,12 @@ import {
|
|||||||
} from "@/lib/zitadel";
|
} from "@/lib/zitadel";
|
||||||
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
||||||
import { HumanUser, User } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
import { HumanUser, User } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
||||||
import { getLocale } from "next-intl/server";
|
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
|
|
||||||
export default async function Page(props: {
|
export default async function Page(props: {
|
||||||
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
||||||
}) {
|
}) {
|
||||||
const searchParams = await props.searchParams;
|
const searchParams = await props.searchParams;
|
||||||
const locale = getLocale();
|
|
||||||
|
|
||||||
const { userId, loginName, organization, requestId, code, initial } =
|
const { userId, loginName, organization, requestId, code, initial } =
|
||||||
searchParams;
|
searchParams;
|
||||||
|
@@ -14,14 +14,12 @@ import {
|
|||||||
} from "@/lib/zitadel";
|
} from "@/lib/zitadel";
|
||||||
import { Organization } from "@zitadel/proto/zitadel/org/v2/org_pb";
|
import { Organization } from "@zitadel/proto/zitadel/org/v2/org_pb";
|
||||||
import { PasskeysType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
|
import { PasskeysType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
|
||||||
import { getLocale } from "next-intl/server";
|
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
|
|
||||||
export default async function Page(props: {
|
export default async function Page(props: {
|
||||||
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
||||||
}) {
|
}) {
|
||||||
const searchParams = await props.searchParams;
|
const searchParams = await props.searchParams;
|
||||||
const locale = getLocale();
|
|
||||||
|
|
||||||
let { firstname, lastname, email, organization, requestId } = searchParams;
|
let { firstname, lastname, email, organization, requestId } = searchParams;
|
||||||
|
|
||||||
|
@@ -7,14 +7,12 @@ import { getSessionCookieById } from "@/lib/cookies";
|
|||||||
import { getServiceUrlFromHeaders } from "@/lib/service-url";
|
import { getServiceUrlFromHeaders } from "@/lib/service-url";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import { getBrandingSettings, getSession } from "@/lib/zitadel";
|
import { getBrandingSettings, getSession } from "@/lib/zitadel";
|
||||||
import { getLocale } from "next-intl/server";
|
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
|
|
||||||
export default async function Page(props: {
|
export default async function Page(props: {
|
||||||
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
||||||
}) {
|
}) {
|
||||||
const searchParams = await props.searchParams;
|
const searchParams = await props.searchParams;
|
||||||
const locale = getLocale();
|
|
||||||
|
|
||||||
const { loginName, requestId, sessionId, organization } = searchParams;
|
const { loginName, requestId, sessionId, organization } = searchParams;
|
||||||
|
|
||||||
|
@@ -6,14 +6,12 @@ import { UserAvatar } from "@/components/user-avatar";
|
|||||||
import { getServiceUrlFromHeaders } from "@/lib/service-url";
|
import { getServiceUrlFromHeaders } from "@/lib/service-url";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import { getBrandingSettings } from "@/lib/zitadel";
|
import { getBrandingSettings } from "@/lib/zitadel";
|
||||||
import { getLocale } from "next-intl/server";
|
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
|
|
||||||
export default async function Page(props: {
|
export default async function Page(props: {
|
||||||
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
||||||
}) {
|
}) {
|
||||||
const searchParams = await props.searchParams;
|
const searchParams = await props.searchParams;
|
||||||
const locale = getLocale();
|
|
||||||
|
|
||||||
const { loginName, organization, requestId, checkAfter } = searchParams;
|
const { loginName, organization, requestId, checkAfter } = searchParams;
|
||||||
|
|
||||||
|
@@ -8,12 +8,10 @@ import { getServiceUrlFromHeaders } from "@/lib/service-url";
|
|||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import { getBrandingSettings, getUserByID } from "@/lib/zitadel";
|
import { getBrandingSettings, getUserByID } from "@/lib/zitadel";
|
||||||
import { HumanUser, User } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
import { HumanUser, User } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
||||||
import { getLocale } from "next-intl/server";
|
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
|
|
||||||
export default async function Page(props: { searchParams: Promise<any> }) {
|
export default async function Page(props: { searchParams: Promise<any> }) {
|
||||||
const searchParams = await props.searchParams;
|
const searchParams = await props.searchParams;
|
||||||
const locale = getLocale();
|
|
||||||
|
|
||||||
const { userId, loginName, code, organization, requestId, invite, send } =
|
const { userId, loginName, code, organization, requestId, invite, send } =
|
||||||
searchParams;
|
searchParams;
|
||||||
|
@@ -3,11 +3,7 @@ import { Translated } from "@/components/translated";
|
|||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
import { getServiceUrlFromHeaders } from "@/lib/service-url";
|
import { getServiceUrlFromHeaders } from "@/lib/service-url";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import {
|
import { getBrandingSettings, getUserByID } from "@/lib/zitadel";
|
||||||
getBrandingSettings,
|
|
||||||
getLoginSettings,
|
|
||||||
getUserByID,
|
|
||||||
} from "@/lib/zitadel";
|
|
||||||
import { HumanUser, User } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
import { HumanUser, User } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
|
|
||||||
@@ -31,14 +27,6 @@ export default async function Page(props: { searchParams: Promise<any> }) {
|
|||||||
console.warn("Error loading session:", error);
|
console.warn("Error loading session:", error);
|
||||||
});
|
});
|
||||||
|
|
||||||
let loginSettings;
|
|
||||||
if (!requestId) {
|
|
||||||
loginSettings = await getLoginSettings({
|
|
||||||
serviceUrl,
|
|
||||||
organization,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const id = userId ?? sessionFactors?.factors?.user?.id;
|
const id = userId ?? sessionFactors?.factors?.user?.id;
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
import { sendLoginname } from "@/lib/server/loginname";
|
import { sendLoginname } from "@/lib/server/loginname";
|
||||||
import { LoginSettings } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
|
import { LoginSettings } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { ReactNode, useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { Alert } from "./alert";
|
import { Alert } from "./alert";
|
||||||
import { BackButton } from "./back-button";
|
import { BackButton } from "./back-button";
|
||||||
@@ -24,7 +24,6 @@ type Props = {
|
|||||||
suffix?: string;
|
suffix?: string;
|
||||||
submit: boolean;
|
submit: boolean;
|
||||||
allowRegister: boolean;
|
allowRegister: boolean;
|
||||||
children?: ReactNode;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function UsernameForm({
|
export function UsernameForm({
|
||||||
@@ -35,7 +34,6 @@ export function UsernameForm({
|
|||||||
loginSettings,
|
loginSettings,
|
||||||
submit,
|
submit,
|
||||||
allowRegister,
|
allowRegister,
|
||||||
children,
|
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const { register, handleSubmit, formState } = useForm<Inputs>({
|
const { register, handleSubmit, formState } = useForm<Inputs>({
|
||||||
mode: "onBlur",
|
mode: "onBlur",
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
import { useEffect, useState } from "react";
|
|
||||||
|
|
||||||
// Custom hook to read auth record and user profile doc
|
|
||||||
export function useUserData() {
|
|
||||||
const [clientData, setClientData] = useState(null);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
let unsubscribe;
|
|
||||||
|
|
||||||
return unsubscribe;
|
|
||||||
}, [clientData]);
|
|
||||||
|
|
||||||
return { clientData };
|
|
||||||
}
|
|
@@ -108,7 +108,7 @@ export async function registerPasskeyLink(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const [hostname, port] = host.split(":");
|
const [hostname] = host.split(":");
|
||||||
|
|
||||||
if (!hostname) {
|
if (!hostname) {
|
||||||
throw new Error("Could not get hostname");
|
throw new Error("Could not get hostname");
|
||||||
|
@@ -144,7 +144,7 @@ export async function updateSession(options: UpdateSessionCommand) {
|
|||||||
challenges.webAuthN &&
|
challenges.webAuthN &&
|
||||||
!challenges.webAuthN.domain
|
!challenges.webAuthN.domain
|
||||||
) {
|
) {
|
||||||
const [hostname, port] = host.split(":");
|
const [hostname] = host.split(":");
|
||||||
|
|
||||||
challenges.webAuthN.domain = hostname;
|
challenges.webAuthN.domain = hostname;
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ export async function addU2F(command: RegisterU2FCommand) {
|
|||||||
sessionToken: sessionCookie.token,
|
sessionToken: sessionCookie.token,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [hostname, port] = host.split(":");
|
const [hostname] = host.split(":");
|
||||||
|
|
||||||
if (!hostname) {
|
if (!hostname) {
|
||||||
throw new Error("Could not get hostname");
|
throw new Error("Could not get hostname");
|
||||||
|
@@ -28,7 +28,7 @@ export function getServiceUrlFromHeaders(headers: ReadonlyHeaders): {
|
|||||||
const host = headers.get("host");
|
const host = headers.get("host");
|
||||||
|
|
||||||
if (host) {
|
if (host) {
|
||||||
const [hostname, port] = host.split(":");
|
const [hostname] = host.split(":");
|
||||||
if (hostname !== "localhost") {
|
if (hostname !== "localhost") {
|
||||||
instanceUrl = host.startsWith("http") ? host : `https://${host}`;
|
instanceUrl = host.startsWith("http") ? host : `https://${host}`;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user