diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 381501b8..a417bfcd 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -30,10 +30,10 @@ jobs:
with:
version: 8
- - name: Setup Node.js 18.x
+ - name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
- node-version: 18.x
+ node-version: 20.x
- uses: pnpm/action-setup@v2
name: Install pnpm
diff --git a/apps/login/__test__/PasswordComplexity.test.tsx b/apps/login/__test__/PasswordComplexity.test.tsx
index b2216817..da0a7493 100644
--- a/apps/login/__test__/PasswordComplexity.test.tsx
+++ b/apps/login/__test__/PasswordComplexity.test.tsx
@@ -1,5 +1,5 @@
import { render, screen, waitFor, within } from "@testing-library/react";
-import PasswordComplexity from "../ui/PasswordComplexity";
+import PasswordComplexity from "@/ui/PasswordComplexity";
// TODO: Why does this not compile?
// import { ResourceOwnerType } from '@zitadel/server';
@@ -30,14 +30,14 @@ describe("", () => {
requiresSymbol: false,
resourceOwnerType: 0, // ResourceOwnerType.RESOURCE_OWNER_TYPE_UNSPECIFIED,
}}
- />
+ />,
);
});
if (expectSVGTitle === false) {
it(`should not render the feedback element`, async () => {
await waitFor(() => {
expect(
- screen.queryByText(feedbackElementLabel)
+ screen.queryByText(feedbackElementLabel),
).not.toBeInTheDocument();
});
});
@@ -46,12 +46,12 @@ describe("", () => {
await waitFor(async () => {
const svg = within(
screen.getByText(feedbackElementLabel)
- .parentElement as HTMLElement
+ .parentElement as HTMLElement,
).findByRole("img");
expect(await svg).toHaveTextContent(expectSVGTitle);
});
});
}
- }
+ },
);
});
diff --git a/apps/login/cypress/integration/login.cy.ts b/apps/login/cypress/integration/login.cy.ts
index 91d1cd72..206d74b4 100644
--- a/apps/login/cypress/integration/login.cy.ts
+++ b/apps/login/cypress/integration/login.cy.ts
@@ -111,7 +111,7 @@ describe("login", () => {
cy.get('button[type="submit"]').click();
cy.location("pathname", { timeout: 10_000 }).should(
"eq",
- "/passkey/add"
+ "/passkey/add",
);
});
});
@@ -160,7 +160,7 @@ describe("login", () => {
cy.visit("/loginname?loginName=john%40zitadel.com&submit=true");
cy.location("pathname", { timeout: 10_000 }).should(
"eq",
- "/passkey/login"
+ "/passkey/login",
);
});
});
diff --git a/apps/login/package.json b/apps/login/package.json
index 94e4da61..5af904cf 100644
--- a/apps/login/package.json
+++ b/apps/login/package.json
@@ -54,6 +54,7 @@
"tinycolor2": "1.4.2"
},
"devDependencies": {
+ "@zitadel/prettier-config": "workspace:*",
"@bufbuild/buf": "^1.14.0",
"@jest/types": "^29.5.0",
"@testing-library/jest-dom": "^5.16.5",
diff --git a/apps/login/prettier.config.mjs b/apps/login/prettier.config.mjs
new file mode 100644
index 00000000..6df557c2
--- /dev/null
+++ b/apps/login/prettier.config.mjs
@@ -0,0 +1 @@
+export { default } from "@zitadel/prettier-config";
diff --git a/apps/login/readme.md b/apps/login/readme.md
index 02bfaf62..e9510a7c 100644
--- a/apps/login/readme.md
+++ b/apps/login/readme.md
@@ -1,11 +1,11 @@
# ZITADEL Login UI
-This is going to be our next UI for the hosted login. It's based on Next.js 13 and its introduced `app/` directory.
+This is going to be our next UI for the hosted login. It's based on Next.js 13 and its introduced `app/` directory.
The Login UI should provide the following functionality:
-- **Login API:** Uses the new ZITADEL Login API
-- **Server Components:** Making server-first components
+- **Login API:** Uses the new ZITADEL Login API
+- **Server Components:** Making server-first components
## Running Locally
diff --git a/apps/login/app/(login)/accounts/page.tsx b/apps/login/src/app/(login)/accounts/page.tsx
similarity index 87%
rename from apps/login/app/(login)/accounts/page.tsx
rename to apps/login/src/app/(login)/accounts/page.tsx
index 6985ea67..638b7de0 100644
--- a/apps/login/app/(login)/accounts/page.tsx
+++ b/apps/login/src/app/(login)/accounts/page.tsx
@@ -1,10 +1,10 @@
import { Session } from "@zitadel/server";
-import { getBrandingSettings, listSessions, server } from "#/lib/zitadel";
-import { getAllSessionCookieIds } from "#/utils/cookies";
+import { getBrandingSettings, listSessions, server } from "@/lib/zitadel";
+import { getAllSessionCookieIds } from "@/utils/cookies";
import { UserPlusIcon } from "@heroicons/react/24/outline";
import Link from "next/link";
-import SessionsList from "#/ui/SessionsList";
-import DynamicTheme from "#/ui/DynamicTheme";
+import SessionsList from "@/ui/SessionsList";
+import DynamicTheme from "@/ui/DynamicTheme";
async function loadSessions(): Promise {
const ids = await getAllSessionCookieIds();
@@ -12,7 +12,7 @@ async function loadSessions(): Promise {
if (ids && ids.length) {
const response = await listSessions(
server,
- ids.filter((id: string | undefined) => !!id)
+ ids.filter((id: string | undefined) => !!id),
);
return response?.sessions ?? [];
} else {
diff --git a/apps/login/app/(login)/error.tsx b/apps/login/src/app/(login)/error.tsx
similarity index 87%
rename from apps/login/app/(login)/error.tsx
rename to apps/login/src/app/(login)/error.tsx
index 614bdbd5..47b2e505 100644
--- a/apps/login/app/(login)/error.tsx
+++ b/apps/login/src/app/(login)/error.tsx
@@ -1,7 +1,7 @@
"use client";
-import { Boundary } from "#/ui/Boundary";
-import { Button } from "#/ui/Button";
+import { Boundary } from "@/ui/Boundary";
+import { Button } from "@/ui/Button";
import React from "react";
export default function Error({ error, reset }: any) {
diff --git a/apps/login/app/(login)/idp/[provider]/failure/page.tsx b/apps/login/src/app/(login)/idp/[provider]/failure/page.tsx
similarity index 85%
rename from apps/login/app/(login)/idp/[provider]/failure/page.tsx
rename to apps/login/src/app/(login)/idp/[provider]/failure/page.tsx
index aada1c52..2c55493e 100644
--- a/apps/login/app/(login)/idp/[provider]/failure/page.tsx
+++ b/apps/login/src/app/(login)/idp/[provider]/failure/page.tsx
@@ -1,8 +1,8 @@
-import { ProviderSlug } from "#/lib/demos";
-import { getBrandingSettings, server } from "#/lib/zitadel";
-import Alert, { AlertType } from "#/ui/Alert";
-import DynamicTheme from "#/ui/DynamicTheme";
-import IdpSignin from "#/ui/IdpSignin";
+import { ProviderSlug } from "@/lib/demos";
+import { getBrandingSettings, server } from "@/lib/zitadel";
+import Alert, { AlertType } from "@/ui/Alert";
+import DynamicTheme from "@/ui/DynamicTheme";
+import IdpSignin from "@/ui/IdpSignin";
import {
AddHumanUserRequest,
IDPInformation,
diff --git a/apps/login/app/(login)/idp/[provider]/success/page.tsx b/apps/login/src/app/(login)/idp/[provider]/success/page.tsx
similarity index 94%
rename from apps/login/app/(login)/idp/[provider]/success/page.tsx
rename to apps/login/src/app/(login)/idp/[provider]/success/page.tsx
index 9d7777c4..6f41c550 100644
--- a/apps/login/app/(login)/idp/[provider]/success/page.tsx
+++ b/apps/login/src/app/(login)/idp/[provider]/success/page.tsx
@@ -1,8 +1,8 @@
-import { ProviderSlug } from "#/lib/demos";
-import { getBrandingSettings, server } from "#/lib/zitadel";
-import Alert, { AlertType } from "#/ui/Alert";
-import DynamicTheme from "#/ui/DynamicTheme";
-import IdpSignin from "#/ui/IdpSignin";
+import { ProviderSlug } from "@/lib/demos";
+import { getBrandingSettings, server } from "@/lib/zitadel";
+import Alert, { AlertType } from "@/ui/Alert";
+import DynamicTheme from "@/ui/DynamicTheme";
+import IdpSignin from "@/ui/IdpSignin";
import {
AddHumanUserRequest,
IDPInformation,
@@ -63,18 +63,18 @@ const PROVIDER_MAPPING: {
function retrieveIDPIntent(
id: string,
- token: string
+ token: string,
): Promise {
const userService = user.getUser(server);
return userService.retrieveIdentityProviderIntent(
{ idpIntentId: id, idpIntentToken: token },
- {}
+ {},
);
}
function createUser(
provider: ProviderSlug,
- info: IDPInformation
+ info: IDPInformation,
): Promise {
const userData = PROVIDER_MAPPING[provider](info);
const userService = user.getUser(server);
diff --git a/apps/login/app/(login)/idp/page.tsx b/apps/login/src/app/(login)/idp/page.tsx
similarity index 92%
rename from apps/login/app/(login)/idp/page.tsx
rename to apps/login/src/app/(login)/idp/page.tsx
index c1da2178..f9ea08d8 100644
--- a/apps/login/app/(login)/idp/page.tsx
+++ b/apps/login/src/app/(login)/idp/page.tsx
@@ -2,9 +2,9 @@ import {
getBrandingSettings,
getLegalAndSupportSettings,
server,
-} from "#/lib/zitadel";
-import DynamicTheme from "#/ui/DynamicTheme";
-import { SignInWithIDP } from "#/ui/SignInWithIDP";
+} from "@/lib/zitadel";
+import DynamicTheme from "@/ui/DynamicTheme";
+import { SignInWithIDP } from "@/ui/SignInWithIDP";
import {
GetActiveIdentityProvidersResponse,
IdentityProvider,
@@ -14,13 +14,13 @@ import {
function getIdentityProviders(
server: ZitadelServer,
- orgId?: string
+ orgId?: string,
): Promise {
const settingsService = settings.getSettings(server);
return settingsService
.getActiveIdentityProviders(
orgId ? { ctx: { orgId } } : { ctx: { instance: true } },
- {}
+ {},
)
.then((resp: GetActiveIdentityProvidersResponse) => {
return resp.identityProviders;
diff --git a/apps/login/app/(login)/loginname/page.tsx b/apps/login/src/app/(login)/loginname/page.tsx
similarity index 91%
rename from apps/login/app/(login)/loginname/page.tsx
rename to apps/login/src/app/(login)/loginname/page.tsx
index b85a8a09..ca875b6b 100644
--- a/apps/login/app/(login)/loginname/page.tsx
+++ b/apps/login/src/app/(login)/loginname/page.tsx
@@ -3,10 +3,10 @@ import {
getLegalAndSupportSettings,
getLoginSettings,
server,
-} from "#/lib/zitadel";
-import DynamicTheme from "#/ui/DynamicTheme";
-import { SignInWithIDP } from "#/ui/SignInWithIDP";
-import UsernameForm from "#/ui/UsernameForm";
+} from "@/lib/zitadel";
+import DynamicTheme from "@/ui/DynamicTheme";
+import { SignInWithIDP } from "@/ui/SignInWithIDP";
+import UsernameForm from "@/ui/UsernameForm";
import {
GetActiveIdentityProvidersResponse,
IdentityProvider,
@@ -16,13 +16,13 @@ import {
function getIdentityProviders(
server: ZitadelServer,
- orgId?: string
+ orgId?: string,
): Promise {
const settingsService = settings.getSettings(server);
return settingsService
.getActiveIdentityProviders(
orgId ? { ctx: { orgId } } : { ctx: { instance: true } },
- {}
+ {},
)
.then((resp: GetActiveIdentityProvidersResponse) => {
return resp.identityProviders;
diff --git a/apps/login/app/(login)/mfa/page.tsx b/apps/login/src/app/(login)/mfa/page.tsx
similarity index 88%
rename from apps/login/app/(login)/mfa/page.tsx
rename to apps/login/src/app/(login)/mfa/page.tsx
index b8a8d468..1d13c02f 100644
--- a/apps/login/app/(login)/mfa/page.tsx
+++ b/apps/login/src/app/(login)/mfa/page.tsx
@@ -3,15 +3,15 @@ import {
getSession,
listAuthenticationMethodTypes,
server,
-} from "#/lib/zitadel";
-import Alert from "#/ui/Alert";
-import ChooseSecondFactor from "#/ui/ChooseSecondFactor";
-import DynamicTheme from "#/ui/DynamicTheme";
-import UserAvatar from "#/ui/UserAvatar";
+} from "@/lib/zitadel";
+import Alert from "@/ui/Alert";
+import ChooseSecondFactor from "@/ui/ChooseSecondFactor";
+import DynamicTheme from "@/ui/DynamicTheme";
+import UserAvatar from "@/ui/UserAvatar";
import {
getMostRecentCookieWithLoginname,
getSessionCookieById,
-} from "#/utils/cookies";
+} from "@/utils/cookies";
export default async function Page({
searchParams,
@@ -27,16 +27,16 @@ export default async function Page({
async function loadSessionByLoginname(
loginName?: string,
- organization?: string
+ organization?: string,
) {
const recent = await getMostRecentCookieWithLoginname(
loginName,
- organization
+ organization,
);
return getSession(server, recent.id, recent.token).then((response) => {
if (response?.session && response.session.factors?.user?.id) {
return listAuthenticationMethodTypes(
- response.session.factors.user.id
+ response.session.factors.user.id,
).then((methods) => {
return {
factors: response.session?.factors,
@@ -52,7 +52,7 @@ export default async function Page({
return getSession(server, recent.id, recent.token).then((response) => {
if (response?.session && response.session.factors?.user?.id) {
return listAuthenticationMethodTypes(
- response.session.factors.user.id
+ response.session.factors.user.id,
).then((methods) => {
return {
factors: response.session?.factors,
diff --git a/apps/login/app/(login)/mfa/set/page.tsx b/apps/login/src/app/(login)/mfa/set/page.tsx
similarity index 93%
rename from apps/login/app/(login)/mfa/set/page.tsx
rename to apps/login/src/app/(login)/mfa/set/page.tsx
index f8549780..9d855b10 100644
--- a/apps/login/app/(login)/mfa/set/page.tsx
+++ b/apps/login/src/app/(login)/mfa/set/page.tsx
@@ -5,15 +5,15 @@ import {
getUserByID,
listAuthenticationMethodTypes,
server,
-} from "#/lib/zitadel";
-import Alert from "#/ui/Alert";
-import ChooseSecondFactorToSetup from "#/ui/ChooseSecondFactorToSetup";
-import DynamicTheme from "#/ui/DynamicTheme";
-import UserAvatar from "#/ui/UserAvatar";
+} from "@/lib/zitadel";
+import Alert from "@/ui/Alert";
+import ChooseSecondFactorToSetup from "@/ui/ChooseSecondFactorToSetup";
+import DynamicTheme from "@/ui/DynamicTheme";
+import UserAvatar from "@/ui/UserAvatar";
import {
getMostRecentCookieWithLoginname,
getSessionCookieById,
-} from "#/utils/cookies";
+} from "@/utils/cookies";
import { user } from "@zitadel/server";
export default async function Page({
@@ -30,11 +30,11 @@ export default async function Page({
async function loadSessionByLoginname(
loginName?: string,
- organization?: string
+ organization?: string,
) {
const recent = await getMostRecentCookieWithLoginname(
loginName,
- organization
+ organization,
);
return getSession(server, recent.id, recent.token).then((response) => {
if (response?.session && response.session.factors?.user?.id) {
diff --git a/apps/login/app/(login)/otp/[method]/page.tsx b/apps/login/src/app/(login)/otp/[method]/page.tsx
similarity index 89%
rename from apps/login/app/(login)/otp/[method]/page.tsx
rename to apps/login/src/app/(login)/otp/[method]/page.tsx
index 3e1e5bb8..814c75e5 100644
--- a/apps/login/app/(login)/otp/[method]/page.tsx
+++ b/apps/login/src/app/(login)/otp/[method]/page.tsx
@@ -3,12 +3,12 @@ import {
getLoginSettings,
getSession,
server,
-} from "#/lib/zitadel";
-import Alert from "#/ui/Alert";
-import DynamicTheme from "#/ui/DynamicTheme";
-import LoginOTP from "#/ui/LoginOTP";
-import UserAvatar from "#/ui/UserAvatar";
-import { getMostRecentCookieWithLoginname } from "#/utils/cookies";
+} from "@/lib/zitadel";
+import Alert from "@/ui/Alert";
+import DynamicTheme from "@/ui/DynamicTheme";
+import LoginOTP from "@/ui/LoginOTP";
+import UserAvatar from "@/ui/UserAvatar";
+import { getMostRecentCookieWithLoginname } from "@/utils/cookies";
export default async function Page({
searchParams,
@@ -29,7 +29,7 @@ export default async function Page({
async function loadSession(loginName?: string, organization?: string) {
const recent = await getMostRecentCookieWithLoginname(
loginName,
- organization
+ organization,
);
return getSession(server, recent.id, recent.token).then((response) => {
diff --git a/apps/login/app/(login)/otp/[method]/set/page.tsx b/apps/login/src/app/(login)/otp/[method]/set/page.tsx
similarity index 91%
rename from apps/login/app/(login)/otp/[method]/set/page.tsx
rename to apps/login/src/app/(login)/otp/[method]/set/page.tsx
index 45649452..f1785fd6 100644
--- a/apps/login/app/(login)/otp/[method]/set/page.tsx
+++ b/apps/login/src/app/(login)/otp/[method]/set/page.tsx
@@ -5,14 +5,14 @@ import {
getSession,
registerTOTP,
server,
-} from "#/lib/zitadel";
-import Alert from "#/ui/Alert";
-import { Button, ButtonVariants } from "#/ui/Button";
-import DynamicTheme from "#/ui/DynamicTheme";
-import { Spinner } from "#/ui/Spinner";
-import TOTPRegister from "#/ui/TOTPRegister";
-import UserAvatar from "#/ui/UserAvatar";
-import { getMostRecentCookieWithLoginname } from "#/utils/cookies";
+} from "@/lib/zitadel";
+import Alert from "@/ui/Alert";
+import { Button, ButtonVariants } from "@/ui/Button";
+import DynamicTheme from "@/ui/DynamicTheme";
+import { Spinner } from "@/ui/Spinner";
+import TOTPRegister from "@/ui/TOTPRegister";
+import UserAvatar from "@/ui/UserAvatar";
+import { getMostRecentCookieWithLoginname } from "@/utils/cookies";
import { RegisterTOTPResponse } from "@zitadel/server";
import Link from "next/link";
import { ClientError } from "nice-grpc";
@@ -60,7 +60,7 @@ export default async function Page({
async function loadSession(loginName?: string, organization?: string) {
const recent = await getMostRecentCookieWithLoginname(
loginName,
- organization
+ organization,
);
return getSession(server, recent.id, recent.token).then((response) => {
@@ -149,8 +149,8 @@ export default async function Page({
{method === "email"
? "Code via email was successfully added."
: method === "sms"
- ? "Code via SMS was successfully added."
- : ""}
+ ? "Code via SMS was successfully added."
+ : ""}
diff --git a/apps/login/app/(login)/passkey/add/page.tsx b/apps/login/src/app/(login)/passkey/add/page.tsx
similarity index 88%
rename from apps/login/app/(login)/passkey/add/page.tsx
rename to apps/login/src/app/(login)/passkey/add/page.tsx
index a955c51d..33980960 100644
--- a/apps/login/app/(login)/passkey/add/page.tsx
+++ b/apps/login/src/app/(login)/passkey/add/page.tsx
@@ -1,9 +1,9 @@
-import { getBrandingSettings, getSession, server } from "#/lib/zitadel";
-import Alert, { AlertType } from "#/ui/Alert";
-import DynamicTheme from "#/ui/DynamicTheme";
-import RegisterPasskey from "#/ui/RegisterPasskey";
-import UserAvatar from "#/ui/UserAvatar";
-import { getMostRecentCookieWithLoginname } from "#/utils/cookies";
+import { getBrandingSettings, getSession, server } from "@/lib/zitadel";
+import Alert, { AlertType } from "@/ui/Alert";
+import DynamicTheme from "@/ui/DynamicTheme";
+import RegisterPasskey from "@/ui/RegisterPasskey";
+import UserAvatar from "@/ui/UserAvatar";
+import { getMostRecentCookieWithLoginname } from "@/utils/cookies";
export default async function Page({
searchParams,
@@ -18,7 +18,7 @@ export default async function Page({
async function loadSession(loginName?: string) {
const recent = await getMostRecentCookieWithLoginname(
loginName,
- organization
+ organization,
);
return getSession(server, recent.id, recent.token).then((response) => {
if (response?.session) {
diff --git a/apps/login/app/(login)/passkey/login/page.tsx b/apps/login/src/app/(login)/passkey/login/page.tsx
similarity index 88%
rename from apps/login/app/(login)/passkey/login/page.tsx
rename to apps/login/src/app/(login)/passkey/login/page.tsx
index 3038fe7c..00a1b2a1 100644
--- a/apps/login/app/(login)/passkey/login/page.tsx
+++ b/apps/login/src/app/(login)/passkey/login/page.tsx
@@ -1,12 +1,12 @@
-import { getBrandingSettings, getSession, server } from "#/lib/zitadel";
-import Alert from "#/ui/Alert";
-import DynamicTheme from "#/ui/DynamicTheme";
-import LoginPasskey from "#/ui/LoginPasskey";
-import UserAvatar from "#/ui/UserAvatar";
+import { getBrandingSettings, getSession, server } from "@/lib/zitadel";
+import Alert from "@/ui/Alert";
+import DynamicTheme from "@/ui/DynamicTheme";
+import LoginPasskey from "@/ui/LoginPasskey";
+import UserAvatar from "@/ui/UserAvatar";
import {
getMostRecentCookieWithLoginname,
getSessionCookieById,
-} from "#/utils/cookies";
+} from "@/utils/cookies";
const title = "Authenticate with a passkey";
const description =
@@ -26,11 +26,11 @@ export default async function Page({
async function loadSessionByLoginname(
loginName?: string,
- organization?: string
+ organization?: string,
) {
const recent = await getMostRecentCookieWithLoginname(
loginName,
- organization
+ organization,
);
return getSession(server, recent.id, recent.token).then((response) => {
if (response?.session) {
diff --git a/apps/login/app/(login)/password/page.tsx b/apps/login/src/app/(login)/password/page.tsx
similarity index 87%
rename from apps/login/app/(login)/password/page.tsx
rename to apps/login/src/app/(login)/password/page.tsx
index 473d46bd..75938ccd 100644
--- a/apps/login/app/(login)/password/page.tsx
+++ b/apps/login/src/app/(login)/password/page.tsx
@@ -3,12 +3,12 @@ import {
getLoginSettings,
getSession,
server,
-} from "#/lib/zitadel";
-import Alert from "#/ui/Alert";
-import DynamicTheme from "#/ui/DynamicTheme";
-import PasswordForm from "#/ui/PasswordForm";
-import UserAvatar from "#/ui/UserAvatar";
-import { getMostRecentCookieWithLoginname } from "#/utils/cookies";
+} from "@/lib/zitadel";
+import Alert from "@/ui/Alert";
+import DynamicTheme from "@/ui/DynamicTheme";
+import PasswordForm from "@/ui/PasswordForm";
+import UserAvatar from "@/ui/UserAvatar";
+import { getMostRecentCookieWithLoginname } from "@/utils/cookies";
export default async function Page({
searchParams,
@@ -22,7 +22,7 @@ export default async function Page({
async function loadSession(loginName?: string, organization?: string) {
const recent = await getMostRecentCookieWithLoginname(
loginName,
- organization
+ organization,
);
return getSession(server, recent.id, recent.token).then((response) => {
diff --git a/apps/login/app/(login)/register/page.tsx b/apps/login/src/app/(login)/register/page.tsx
similarity index 89%
rename from apps/login/app/(login)/register/page.tsx
rename to apps/login/src/app/(login)/register/page.tsx
index 506b9df0..b41634c4 100644
--- a/apps/login/app/(login)/register/page.tsx
+++ b/apps/login/src/app/(login)/register/page.tsx
@@ -3,10 +3,10 @@ import {
getLegalAndSupportSettings,
getPasswordComplexitySettings,
server,
-} from "#/lib/zitadel";
-import DynamicTheme from "#/ui/DynamicTheme";
-import RegisterFormWithoutPassword from "#/ui/RegisterFormWithoutPassword";
-import SetPasswordForm from "#/ui/SetPasswordForm";
+} from "@/lib/zitadel";
+import DynamicTheme from "@/ui/DynamicTheme";
+import RegisterFormWithoutPassword from "@/ui/RegisterFormWithoutPassword";
+import SetPasswordForm from "@/ui/SetPasswordForm";
export default async function Page({
searchParams,
@@ -21,7 +21,7 @@ export default async function Page({
const legal = await getLegalAndSupportSettings(server, organization);
const passwordComplexitySettings = await getPasswordComplexitySettings(
server,
- organization
+ organization,
);
const branding = await getBrandingSettings(server, organization);
diff --git a/apps/login/app/(login)/signedin/page.tsx b/apps/login/src/app/(login)/signedin/page.tsx
similarity index 89%
rename from apps/login/app/(login)/signedin/page.tsx
rename to apps/login/src/app/(login)/signedin/page.tsx
index 8f45b0d8..edf4b491 100644
--- a/apps/login/app/(login)/signedin/page.tsx
+++ b/apps/login/src/app/(login)/signedin/page.tsx
@@ -3,10 +3,10 @@ import {
getBrandingSettings,
getSession,
server,
-} from "#/lib/zitadel";
-import DynamicTheme from "#/ui/DynamicTheme";
-import UserAvatar from "#/ui/UserAvatar";
-import { getMostRecentCookieWithLoginname } from "#/utils/cookies";
+} from "@/lib/zitadel";
+import DynamicTheme from "@/ui/DynamicTheme";
+import UserAvatar from "@/ui/UserAvatar";
+import { getMostRecentCookieWithLoginname } from "@/utils/cookies";
import { redirect } from "next/navigation";
async function loadSession(loginName: string, authRequestId?: string) {
diff --git a/apps/login/app/(login)/u2f/page.tsx b/apps/login/src/app/(login)/u2f/page.tsx
similarity index 90%
rename from apps/login/app/(login)/u2f/page.tsx
rename to apps/login/src/app/(login)/u2f/page.tsx
index 91a0e5b1..87573bca 100644
--- a/apps/login/app/(login)/u2f/page.tsx
+++ b/apps/login/src/app/(login)/u2f/page.tsx
@@ -3,15 +3,15 @@ import {
getLoginSettings,
getSession,
server,
-} from "#/lib/zitadel";
-import Alert from "#/ui/Alert";
-import DynamicTheme from "#/ui/DynamicTheme";
-import LoginPasskey from "#/ui/LoginPasskey";
-import UserAvatar from "#/ui/UserAvatar";
+} from "@/lib/zitadel";
+import Alert from "@/ui/Alert";
+import DynamicTheme from "@/ui/DynamicTheme";
+import LoginPasskey from "@/ui/LoginPasskey";
+import UserAvatar from "@/ui/UserAvatar";
import {
getMostRecentCookieWithLoginname,
getSessionCookieById,
-} from "#/utils/cookies";
+} from "@/utils/cookies";
export default async function Page({
searchParams,
@@ -30,11 +30,11 @@ export default async function Page({
async function loadSessionByLoginname(
loginName?: string,
- organization?: string
+ organization?: string,
) {
const recent = await getMostRecentCookieWithLoginname(
loginName,
- organization
+ organization,
);
return getSession(server, recent.id, recent.token).then((response) => {
if (response?.session) {
diff --git a/apps/login/app/(login)/u2f/set/page.tsx b/apps/login/src/app/(login)/u2f/set/page.tsx
similarity index 82%
rename from apps/login/app/(login)/u2f/set/page.tsx
rename to apps/login/src/app/(login)/u2f/set/page.tsx
index 6df52622..c51c88cf 100644
--- a/apps/login/app/(login)/u2f/set/page.tsx
+++ b/apps/login/src/app/(login)/u2f/set/page.tsx
@@ -1,10 +1,10 @@
-import { getBrandingSettings, getSession, server } from "#/lib/zitadel";
-import Alert, { AlertType } from "#/ui/Alert";
-import DynamicTheme from "#/ui/DynamicTheme";
-import RegisterPasskey from "#/ui/RegisterPasskey";
-import RegisterU2F from "#/ui/RegisterU2F";
-import UserAvatar from "#/ui/UserAvatar";
-import { getMostRecentCookieWithLoginname } from "#/utils/cookies";
+import { getBrandingSettings, getSession, server } from "@/lib/zitadel";
+import Alert, { AlertType } from "@/ui/Alert";
+import DynamicTheme from "@/ui/DynamicTheme";
+import RegisterPasskey from "@/ui/RegisterPasskey";
+import RegisterU2F from "@/ui/RegisterU2F";
+import UserAvatar from "@/ui/UserAvatar";
+import { getMostRecentCookieWithLoginname } from "@/utils/cookies";
export default async function Page({
searchParams,
@@ -18,7 +18,7 @@ export default async function Page({
async function loadSession(loginName?: string) {
const recent = await getMostRecentCookieWithLoginname(
loginName,
- organization
+ organization,
);
return getSession(server, recent.id, recent.token).then((response) => {
if (response?.session) {
diff --git a/apps/login/app/(login)/verify/page.tsx b/apps/login/src/app/(login)/verify/page.tsx
similarity index 89%
rename from apps/login/app/(login)/verify/page.tsx
rename to apps/login/src/app/(login)/verify/page.tsx
index 32be2530..0049fcec 100644
--- a/apps/login/app/(login)/verify/page.tsx
+++ b/apps/login/src/app/(login)/verify/page.tsx
@@ -1,6 +1,6 @@
-import { getBrandingSettings, server } from "#/lib/zitadel";
-import DynamicTheme from "#/ui/DynamicTheme";
-import VerifyEmailForm from "#/ui/VerifyEmailForm";
+import { getBrandingSettings, server } from "@/lib/zitadel";
+import DynamicTheme from "@/ui/DynamicTheme";
+import VerifyEmailForm from "@/ui/VerifyEmailForm";
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
export default async function Page({ searchParams }: { searchParams: any }) {
diff --git a/apps/login/app/api/idp/start/route.ts b/apps/login/src/app/api/idp/start/route.ts
similarity index 90%
rename from apps/login/app/api/idp/start/route.ts
rename to apps/login/src/app/api/idp/start/route.ts
index 18a7f61e..795e563f 100644
--- a/apps/login/app/api/idp/start/route.ts
+++ b/apps/login/src/app/api/idp/start/route.ts
@@ -1,4 +1,4 @@
-import { server, startIdentityProviderFlow } from "#/lib/zitadel";
+import { server, startIdentityProviderFlow } from "@/lib/zitadel";
import { NextRequest, NextResponse } from "next/server";
export async function POST(request: NextRequest) {
diff --git a/apps/login/app/api/loginname/route.ts b/apps/login/src/app/api/loginname/route.ts
similarity index 89%
rename from apps/login/app/api/loginname/route.ts
rename to apps/login/src/app/api/loginname/route.ts
index 8b559e1f..75c9635c 100644
--- a/apps/login/app/api/loginname/route.ts
+++ b/apps/login/src/app/api/loginname/route.ts
@@ -1,5 +1,5 @@
-import { listAuthenticationMethodTypes, listUsers } from "#/lib/zitadel";
-import { createSessionForUserIdAndUpdateCookie } from "#/utils/session";
+import { listAuthenticationMethodTypes, listUsers } from "@/lib/zitadel";
+import { createSessionForUserIdAndUpdateCookie } from "@/utils/session";
import { NextRequest, NextResponse } from "next/server";
export async function POST(request: NextRequest) {
@@ -17,7 +17,7 @@ export async function POST(request: NextRequest) {
userId,
undefined,
undefined,
- authRequestId
+ authRequestId,
)
.then((session) => {
if (session.factors?.user?.id) {
@@ -43,7 +43,7 @@ export async function POST(request: NextRequest) {
} else {
return NextResponse.json(
{ message: "Could not find user" },
- { status: 404 }
+ { status: 404 },
);
}
});
diff --git a/apps/login/app/api/otp/set/route.ts b/apps/login/src/app/api/otp/set/route.ts
similarity index 78%
rename from apps/login/app/api/otp/set/route.ts
rename to apps/login/src/app/api/otp/set/route.ts
index 38be7023..244702cd 100644
--- a/apps/login/app/api/otp/set/route.ts
+++ b/apps/login/src/app/api/otp/set/route.ts
@@ -3,8 +3,8 @@ import {
getMostRecentSessionCookie,
getSessionCookieById,
getSessionCookieByLoginName,
-} from "#/utils/cookies";
-import { setSessionAndUpdateCookie } from "#/utils/session";
+} from "@/utils/cookies";
+import { setSessionAndUpdateCookie } from "@/utils/session";
import { Checks } from "@zitadel/server";
import { NextRequest, NextResponse, userAgent } from "next/server";
@@ -20,12 +20,14 @@ export async function POST(request: NextRequest) {
return Promise.reject(error);
})
: loginName
- ? getSessionCookieByLoginName(loginName, organization).catch((error) => {
- return Promise.reject(error);
- })
- : getMostRecentSessionCookie().catch((error) => {
- return Promise.reject(error);
- });
+ ? getSessionCookieByLoginName(loginName, organization).catch(
+ (error) => {
+ return Promise.reject(error);
+ },
+ )
+ : getMostRecentSessionCookie().catch((error) => {
+ return Promise.reject(error);
+ });
return recentPromise
.then((recent) => {
@@ -49,7 +51,7 @@ export async function POST(request: NextRequest) {
recent,
checks,
undefined,
- authRequestId
+ authRequestId,
).then((session) => {
return NextResponse.json({
sessionId: session.id,
@@ -64,7 +66,7 @@ export async function POST(request: NextRequest) {
} else {
return NextResponse.json(
{ details: "Request body is missing" },
- { status: 400 }
+ { status: 400 },
);
}
}
diff --git a/apps/login/app/api/passkeys/route.ts b/apps/login/src/app/api/passkeys/route.ts
similarity index 89%
rename from apps/login/app/api/passkeys/route.ts
rename to apps/login/src/app/api/passkeys/route.ts
index 55990262..36293280 100644
--- a/apps/login/app/api/passkeys/route.ts
+++ b/apps/login/src/app/api/passkeys/route.ts
@@ -3,8 +3,8 @@ import {
getSession,
registerPasskey,
server,
-} from "#/lib/zitadel";
-import { getSessionCookieById } from "#/utils/cookies";
+} from "@/lib/zitadel";
+import { getSessionCookieById } from "@/utils/cookies";
import { NextRequest, NextResponse } from "next/server";
export async function POST(request: NextRequest) {
@@ -17,7 +17,7 @@ export async function POST(request: NextRequest) {
const session = await getSession(
server,
sessionCookie.id,
- sessionCookie.token
+ sessionCookie.token,
);
const domain: string = request.nextUrl.hostname;
@@ -40,7 +40,7 @@ export async function POST(request: NextRequest) {
} else {
return NextResponse.json(
{ details: "could not get session" },
- { status: 500 }
+ { status: 500 },
);
}
} else {
diff --git a/apps/login/app/api/passkeys/verify/route.ts b/apps/login/src/app/api/passkeys/verify/route.ts
similarity index 86%
rename from apps/login/app/api/passkeys/verify/route.ts
rename to apps/login/src/app/api/passkeys/verify/route.ts
index 1346ecc6..4cfd8342 100644
--- a/apps/login/app/api/passkeys/verify/route.ts
+++ b/apps/login/src/app/api/passkeys/verify/route.ts
@@ -1,5 +1,5 @@
-import { getSession, server, verifyPasskeyRegistration } from "#/lib/zitadel";
-import { getSessionCookieById } from "#/utils/cookies";
+import { getSession, server, verifyPasskeyRegistration } from "@/lib/zitadel";
+import { getSessionCookieById } from "@/utils/cookies";
import { NextRequest, NextResponse, userAgent } from "next/server";
export async function POST(request: NextRequest) {
@@ -18,7 +18,7 @@ export async function POST(request: NextRequest) {
const session = await getSession(
server,
sessionCookie.id,
- sessionCookie.token
+ sessionCookie.token,
);
const userId = session?.session?.factors?.user?.id;
@@ -29,7 +29,7 @@ export async function POST(request: NextRequest) {
passkeyId,
passkeyName,
publicKeyCredential,
- userId
+ userId,
)
.then((resp) => {
return NextResponse.json(resp);
@@ -40,7 +40,7 @@ export async function POST(request: NextRequest) {
} else {
return NextResponse.json(
{ details: "could not get session" },
- { status: 500 }
+ { status: 500 },
);
}
} else {
diff --git a/apps/login/app/api/registeruser/route.ts b/apps/login/src/app/api/registeruser/route.ts
similarity index 90%
rename from apps/login/app/api/registeruser/route.ts
rename to apps/login/src/app/api/registeruser/route.ts
index 57539614..7ed49f48 100644
--- a/apps/login/app/api/registeruser/route.ts
+++ b/apps/login/src/app/api/registeruser/route.ts
@@ -1,8 +1,8 @@
-import { addHumanUser, server } from "#/lib/zitadel";
+import { addHumanUser, server } from "@/lib/zitadel";
import {
createSessionAndUpdateCookie,
createSessionForUserIdAndUpdateCookie,
-} from "#/utils/session";
+} from "@/utils/session";
import { NextRequest, NextResponse } from "next/server";
export async function POST(request: NextRequest) {
@@ -29,7 +29,7 @@ export async function POST(request: NextRequest) {
user.userId,
password,
undefined,
- authRequestId
+ authRequestId,
).then((session) => {
return NextResponse.json({
userId: user.userId,
diff --git a/apps/login/app/api/resendverifyemail/route.ts b/apps/login/src/app/api/resendverifyemail/route.ts
similarity index 91%
rename from apps/login/app/api/resendverifyemail/route.ts
rename to apps/login/src/app/api/resendverifyemail/route.ts
index 15376ee7..3ccd724d 100644
--- a/apps/login/app/api/resendverifyemail/route.ts
+++ b/apps/login/src/app/api/resendverifyemail/route.ts
@@ -1,4 +1,4 @@
-import { setEmail, server } from "#/lib/zitadel";
+import { setEmail, server } from "@/lib/zitadel";
import { NextRequest, NextResponse } from "next/server";
export async function POST(request: NextRequest) {
diff --git a/apps/login/app/api/session/route.ts b/apps/login/src/app/api/session/route.ts
similarity index 87%
rename from apps/login/app/api/session/route.ts
rename to apps/login/src/app/api/session/route.ts
index 29d5167b..40493340 100644
--- a/apps/login/app/api/session/route.ts
+++ b/apps/login/src/app/api/session/route.ts
@@ -4,19 +4,19 @@ import {
getSession,
getUserByID,
listAuthenticationMethodTypes,
-} from "#/lib/zitadel";
+} from "@/lib/zitadel";
import {
SessionCookie,
getMostRecentSessionCookie,
getSessionCookieById,
getSessionCookieByLoginName,
removeSessionFromCookie,
-} from "#/utils/cookies";
+} from "@/utils/cookies";
import {
createSessionAndUpdateCookie,
createSessionForIdpAndUpdateCookie,
setSessionAndUpdateCookie,
-} from "#/utils/session";
+} from "@/utils/session";
import { Challenges, Checks, RequestChallenges } from "@zitadel/server";
import { NextRequest, NextResponse } from "next/server";
@@ -37,7 +37,7 @@ export async function POST(request: NextRequest) {
userId,
idpIntent,
organization,
- authRequestId
+ authRequestId,
).then((session) => {
return NextResponse.json(session);
});
@@ -47,7 +47,7 @@ export async function POST(request: NextRequest) {
password,
undefined,
organization,
- authRequestId
+ authRequestId,
).then((session) => {
return NextResponse.json(session);
});
@@ -55,7 +55,7 @@ export async function POST(request: NextRequest) {
} else {
return NextResponse.json(
{ details: "Session could not be created" },
- { status: 500 }
+ { status: 500 },
);
}
}
@@ -83,12 +83,14 @@ export async function PUT(request: NextRequest) {
return Promise.reject(error);
})
: loginName
- ? getSessionCookieByLoginName(loginName, organization).catch((error) => {
- return Promise.reject(error);
- })
- : getMostRecentSessionCookie().catch((error) => {
- return Promise.reject(error);
- });
+ ? getSessionCookieByLoginName(loginName, organization).catch(
+ (error) => {
+ return Promise.reject(error);
+ },
+ )
+ : getMostRecentSessionCookie().catch((error) => {
+ return Promise.reject(error);
+ });
const domain: string = request.nextUrl.hostname;
@@ -105,11 +107,11 @@ export async function PUT(request: NextRequest) {
const sessionResponse = await getSession(
server,
recent.id,
- recent.token
+ recent.token,
);
if (sessionResponse && sessionResponse.session?.factors?.user?.id) {
const userResponse = await getUserByID(
- sessionResponse.session.factors.user.id
+ sessionResponse.session.factors.user.id,
);
if (
challenges.otpEmail === "" &&
@@ -131,13 +133,13 @@ export async function PUT(request: NextRequest) {
recent,
checks,
challenges,
- authRequestId
+ authRequestId,
).then(async (session) => {
// if password, check if user has MFA methods
let authMethods;
if (checks && checks.password && session.factors?.user?.id) {
const response = await listAuthenticationMethodTypes(
- session.factors?.user?.id
+ session.factors?.user?.id,
);
if (response.authMethodTypes && response.authMethodTypes.length) {
authMethods = response.authMethodTypes;
@@ -159,7 +161,7 @@ export async function PUT(request: NextRequest) {
} else {
return NextResponse.json(
{ details: "Request body is missing" },
- { status: 400 }
+ { status: 400 },
);
}
}
@@ -183,14 +185,14 @@ export async function DELETE(request: NextRequest) {
.catch((error) => {
return NextResponse.json(
{ details: "could not set cookie" },
- { status: 500 }
+ { status: 500 },
);
});
})
.catch((error) => {
return NextResponse.json(
{ details: "could not delete session" },
- { status: 500 }
+ { status: 500 },
);
});
} else {
diff --git a/apps/login/app/api/u2f/route.ts b/apps/login/src/app/api/u2f/route.ts
similarity index 88%
rename from apps/login/app/api/u2f/route.ts
rename to apps/login/src/app/api/u2f/route.ts
index a7026a69..368c5a80 100644
--- a/apps/login/app/api/u2f/route.ts
+++ b/apps/login/src/app/api/u2f/route.ts
@@ -4,8 +4,8 @@ import {
registerPasskey,
registerU2F,
server,
-} from "#/lib/zitadel";
-import { getSessionCookieById } from "#/utils/cookies";
+} from "@/lib/zitadel";
+import { getSessionCookieById } from "@/utils/cookies";
import { NextRequest, NextResponse } from "next/server";
export async function POST(request: NextRequest) {
@@ -18,7 +18,7 @@ export async function POST(request: NextRequest) {
const session = await getSession(
server,
sessionCookie.id,
- sessionCookie.token
+ sessionCookie.token,
);
const domain: string = request.nextUrl.hostname;
@@ -37,7 +37,7 @@ export async function POST(request: NextRequest) {
} else {
return NextResponse.json(
{ details: "could not get session" },
- { status: 500 }
+ { status: 500 },
);
}
} else {
diff --git a/apps/login/app/api/u2f/verify/route.ts b/apps/login/src/app/api/u2f/verify/route.ts
similarity index 88%
rename from apps/login/app/api/u2f/verify/route.ts
rename to apps/login/src/app/api/u2f/verify/route.ts
index c0aee95c..1ea83f72 100644
--- a/apps/login/app/api/u2f/verify/route.ts
+++ b/apps/login/src/app/api/u2f/verify/route.ts
@@ -1,5 +1,5 @@
-import { getSession, server, verifyU2FRegistration } from "#/lib/zitadel";
-import { getSessionCookieById } from "#/utils/cookies";
+import { getSession, server, verifyU2FRegistration } from "@/lib/zitadel";
+import { getSessionCookieById } from "@/utils/cookies";
import { VerifyU2FRegistrationRequest } from "@zitadel/server";
import { NextRequest, NextResponse, userAgent } from "next/server";
@@ -19,7 +19,7 @@ export async function POST(request: NextRequest) {
const session = await getSession(
server,
sessionCookie.id,
- sessionCookie.token
+ sessionCookie.token,
);
const userId = session?.session?.factors?.user?.id;
@@ -41,7 +41,7 @@ export async function POST(request: NextRequest) {
} else {
return NextResponse.json(
{ details: "could not get session" },
- { status: 500 }
+ { status: 500 },
);
}
} else {
diff --git a/apps/login/app/api/verifyemail/route.ts b/apps/login/src/app/api/verifyemail/route.ts
similarity index 89%
rename from apps/login/app/api/verifyemail/route.ts
rename to apps/login/src/app/api/verifyemail/route.ts
index 1b2ddd29..e2aae983 100644
--- a/apps/login/app/api/verifyemail/route.ts
+++ b/apps/login/src/app/api/verifyemail/route.ts
@@ -1,4 +1,4 @@
-import { server, verifyEmail } from "#/lib/zitadel";
+import { server, verifyEmail } from "@/lib/zitadel";
import { NextRequest, NextResponse } from "next/server";
export async function POST(request: NextRequest) {
diff --git a/apps/login/app/layout.tsx b/apps/login/src/app/layout.tsx
similarity index 85%
rename from apps/login/app/layout.tsx
rename to apps/login/src/app/layout.tsx
index 2c4768fc..0eb4b191 100644
--- a/apps/login/app/layout.tsx
+++ b/apps/login/src/app/layout.tsx
@@ -1,15 +1,15 @@
-import "#/styles/globals.scss";
-import { AddressBar } from "#/ui/AddressBar";
-import { GlobalNav } from "#/ui/GlobalNav";
+import "@/styles/globals.scss";
+import { AddressBar } from "@/ui/AddressBar";
+import { GlobalNav } from "@/ui/GlobalNav";
import { Lato } from "next/font/google";
-import { LayoutProviders } from "#/ui/LayoutProviders";
+import { LayoutProviders } from "@/ui/LayoutProviders";
import { Analytics } from "@vercel/analytics/react";
-import ThemeWrapper from "#/ui/ThemeWrapper";
-import { getBrandingSettings } from "#/lib/zitadel";
+import ThemeWrapper from "@/ui/ThemeWrapper";
+import { getBrandingSettings } from "@/lib/zitadel";
import { server } from "../lib/zitadel";
import { BrandingSettings } from "@zitadel/server";
-import ThemeProvider from "#/ui/ThemeProvider";
-import Theme from "#/ui/Theme";
+import ThemeProvider from "@/ui/ThemeProvider";
+import Theme from "@/ui/Theme";
const lato = Lato({
weight: ["400", "700", "900"],
diff --git a/apps/login/app/login/route.ts b/apps/login/src/app/login/route.ts
similarity index 92%
rename from apps/login/app/login/route.ts
rename to apps/login/src/app/login/route.ts
index 1937ad3a..e6a8c335 100644
--- a/apps/login/app/login/route.ts
+++ b/apps/login/src/app/login/route.ts
@@ -4,15 +4,15 @@ import {
getOrgByDomain,
listSessions,
server,
-} from "#/lib/zitadel";
-import { SessionCookie, getAllSessions } from "#/utils/cookies";
+} from "@/lib/zitadel";
+import { SessionCookie, getAllSessions } from "@/utils/cookies";
import { Session, AuthRequest, Prompt } from "@zitadel/server";
import { NextRequest, NextResponse } from "next/server";
async function loadSessions(ids: string[]): Promise
{
const response = await listSessions(
server,
- ids.filter((id: string | undefined) => !!id)
+ ids.filter((id: string | undefined) => !!id),
);
return response?.sessions ?? [];
@@ -23,7 +23,7 @@ const ORG_DOMAIN_SCOPE_REGEX = /urn:zitadel:iam:org:domain:primary:(.+)/; // TOD
function findSession(
sessions: Session[],
- authRequest: AuthRequest
+ authRequest: AuthRequest,
): Session | undefined {
if (authRequest.hintUserId) {
console.log(`find session for hintUserId: ${authRequest.hintUserId}`);
@@ -32,7 +32,7 @@ function findSession(
if (authRequest.loginHint) {
console.log(`find session for loginHint: ${authRequest.loginHint}`);
return sessions.find(
- (s) => s.factors?.user?.loginName === authRequest.loginHint
+ (s) => s.factors?.user?.loginName === authRequest.loginHint,
);
}
if (sessions.length) {
@@ -62,7 +62,7 @@ export async function GET(request: NextRequest) {
if (authRequestId && sessionId) {
console.log(
- `Login with session: ${sessionId} and authRequest: ${authRequestId}`
+ `Login with session: ${sessionId} and authRequest: ${authRequestId}`,
);
let selectedSession = sessions.find((s) => s.id === sessionId);
@@ -70,7 +70,7 @@ export async function GET(request: NextRequest) {
if (selectedSession && selectedSession.id) {
console.log(`Found session ${selectedSession.id}`);
const cookie = sessionCookies.find(
- (cookie) => cookie.id === selectedSession?.id
+ (cookie) => cookie.id === selectedSession?.id,
);
if (cookie && cookie.id && cookie.token) {
@@ -98,7 +98,7 @@ export async function GET(request: NextRequest) {
if (authRequest?.scope) {
const orgScope = authRequest.scope.find((s: string) =>
- ORG_SCOPE_REGEX.test(s)
+ ORG_SCOPE_REGEX.test(s),
);
if (orgScope) {
@@ -106,7 +106,7 @@ export async function GET(request: NextRequest) {
organization = matched?.[1] ?? "";
} else {
const orgDomainScope = authRequest.scope.find((s: string) =>
- ORG_DOMAIN_SCOPE_REGEX.test(s)
+ ORG_DOMAIN_SCOPE_REGEX.test(s),
);
if (orgDomainScope) {
@@ -169,7 +169,7 @@ export async function GET(request: NextRequest) {
if (selectedSession && selectedSession.id) {
const cookie = sessionCookies.find(
- (cookie) => cookie.id === selectedSession?.id
+ (cookie) => cookie.id === selectedSession?.id,
);
if (cookie && cookie.id && cookie.token) {
@@ -185,13 +185,13 @@ export async function GET(request: NextRequest) {
} else {
return NextResponse.json(
{ error: "No active session found" },
- { status: 400 } // TODO: check for correct status code
+ { status: 400 }, // TODO: check for correct status code
);
}
} else {
return NextResponse.json(
{ error: "No active session found" },
- { status: 400 } // TODO: check for correct status code
+ { status: 400 }, // TODO: check for correct status code
);
}
} else {
@@ -200,7 +200,7 @@ export async function GET(request: NextRequest) {
if (selectedSession && selectedSession.id) {
const cookie = sessionCookies.find(
- (cookie) => cookie.id === selectedSession?.id
+ (cookie) => cookie.id === selectedSession?.id,
);
if (cookie && cookie.id && cookie.token) {
@@ -247,7 +247,7 @@ export async function GET(request: NextRequest) {
} else {
return NextResponse.json(
{ error: "No authRequestId provided" },
- { status: 500 }
+ { status: 500 },
);
}
}
diff --git a/apps/login/app/page.tsx b/apps/login/src/app/page.tsx
similarity index 98%
rename from apps/login/app/page.tsx
rename to apps/login/src/app/page.tsx
index 1d4da461..7bddc8ca 100644
--- a/apps/login/app/page.tsx
+++ b/apps/login/src/app/page.tsx
@@ -1,4 +1,4 @@
-import { demos } from "#/lib/demos";
+import { demos } from "@/lib/demos";
import Link from "next/link";
export default function Page() {
diff --git a/apps/login/lib/demos.ts b/apps/login/src/lib/demos.ts
similarity index 100%
rename from apps/login/lib/demos.ts
rename to apps/login/src/lib/demos.ts
diff --git a/apps/login/lib/hooks.ts b/apps/login/src/lib/hooks.ts
similarity index 100%
rename from apps/login/lib/hooks.ts
rename to apps/login/src/lib/hooks.ts
diff --git a/apps/login/lib/server-actions.ts b/apps/login/src/lib/server-actions.ts
similarity index 88%
rename from apps/login/lib/server-actions.ts
rename to apps/login/src/lib/server-actions.ts
index 7928f348..5ced55c6 100644
--- a/apps/login/lib/server-actions.ts
+++ b/apps/login/src/lib/server-actions.ts
@@ -1,12 +1,12 @@
"use server";
-import { getMostRecentCookieWithLoginname } from "#/utils/cookies";
+import { getMostRecentCookieWithLoginname } from "@/utils/cookies";
import { getSession, server, verifyTOTPRegistration } from "./zitadel";
export async function verifyTOTP(
code: string,
loginName?: string,
- organization?: string
+ organization?: string,
) {
return getMostRecentCookieWithLoginname(loginName, organization)
.then((recent) => {
diff --git a/apps/login/lib/zitadel.ts b/apps/login/src/lib/zitadel.ts
similarity index 94%
rename from apps/login/lib/zitadel.ts
rename to apps/login/src/lib/zitadel.ts
index bea3c368..b4f0ec90 100644
--- a/apps/login/lib/zitadel.ts
+++ b/apps/login/src/lib/zitadel.ts
@@ -72,20 +72,20 @@ if (!getServers().length) {
export async function getBrandingSettings(
server: ZitadelServer,
- organization?: string
+ organization?: string,
): Promise {
const settingsService = settings.getSettings(server);
return settingsService
.getBrandingSettings(
{ ctx: organization ? { orgId: organization } : { instance: true } },
- {}
+ {},
)
.then((resp: GetBrandingSettingsResponse) => resp.settings);
}
export async function getLoginSettings(
server: ZitadelServer,
- orgId?: string
+ orgId?: string,
): Promise {
const settingsService = settings.getSettings(server);
return settingsService
@@ -94,27 +94,27 @@ export async function getLoginSettings(
}
export async function verifyMyAuthFactorOTP(
- code: string
+ code: string,
): Promise {
const authService = auth.getAuth(server);
return authService.verifyMyAuthFactorOTP({ code }, {});
}
export async function addOTPEmail(
- userId: string
+ userId: string,
): Promise {
const userService = user.getUser(server);
return userService.addOTPEmail(
{
userId,
},
- {}
+ {},
);
}
export async function addOTPSMS(
userId: string,
- token?: string
+ token?: string,
): Promise {
let userService;
if (token) {
@@ -134,7 +134,7 @@ export async function addOTPSMS(
export async function registerTOTP(
userId: string,
- token?: string
+ token?: string,
): Promise {
let userService;
if (token) {
@@ -153,7 +153,7 @@ export async function registerTOTP(
}
export async function getGeneralSettings(
- server: ZitadelServer
+ server: ZitadelServer,
): Promise {
const settingsService = settings.getSettings(server);
return settingsService
@@ -163,13 +163,13 @@ export async function getGeneralSettings(
export async function getLegalAndSupportSettings(
server: ZitadelServer,
- organization?: string
+ organization?: string,
): Promise {
const settingsService = settings.getSettings(server);
return settingsService
.getLegalAndSupportSettings(
{ ctx: organization ? { orgId: organization } : { instance: true } },
- {}
+ {},
)
.then((resp: GetLegalAndSupportSettingsResponse) => {
return resp.settings;
@@ -178,7 +178,7 @@ export async function getLegalAndSupportSettings(
export async function getPasswordComplexitySettings(
server: ZitadelServer,
- organization?: string
+ organization?: string,
): Promise {
const settingsService = settings.getSettings(server);
@@ -187,7 +187,7 @@ export async function getPasswordComplexitySettings(
organization
? { ctx: { orgId: organization } }
: { ctx: { instance: true } },
- {}
+ {},
)
.then((resp: GetPasswordComplexitySettingsResponse) => resp.settings);
}
@@ -195,7 +195,7 @@ export async function getPasswordComplexitySettings(
export async function createSessionFromChecks(
server: ZitadelServer,
checks: Checks,
- challenges: RequestChallenges | undefined
+ challenges: RequestChallenges | undefined,
): Promise {
const sessionService = session.getSession(server);
return sessionService.createSession(
@@ -207,7 +207,7 @@ export async function createSessionFromChecks(
nanos: 0,
},
},
- {}
+ {},
);
}
@@ -217,7 +217,7 @@ export async function createSessionForUserIdAndIdpIntent(
idpIntent: {
idpIntentId?: string | undefined;
idpIntentToken?: string | undefined;
- }
+ },
): Promise {
const sessionService = session.getSession(server);
@@ -229,7 +229,7 @@ export async function createSessionForUserIdAndIdpIntent(
// nanos: 0,
// },
},
- {}
+ {},
);
}
@@ -238,7 +238,7 @@ export async function setSession(
sessionId: string,
sessionToken: string,
challenges: RequestChallenges | undefined,
- checks: Checks
+ checks: Checks,
): Promise {
const sessionService = session.getSession(server);
@@ -260,7 +260,7 @@ export async function setSession(
export async function getSession(
server: ZitadelServer,
sessionId: string,
- sessionToken: string
+ sessionToken: string,
): Promise {
const sessionService = session.getSession(server);
return sessionService.getSession({ sessionId, sessionToken }, {});
@@ -269,7 +269,7 @@ export async function getSession(
export async function deleteSession(
server: ZitadelServer,
sessionId: string,
- sessionToken: string
+ sessionToken: string,
): Promise {
const sessionService = session.getSession(server);
return sessionService.deleteSession({ sessionId, sessionToken }, {});
@@ -277,7 +277,7 @@ export async function deleteSession(
export async function listSessions(
server: ZitadelServer,
- ids: string[]
+ ids: string[],
): Promise {
const sessionService = session.getSession(server);
const query = { offset: 0, limit: 100, asc: true };
@@ -295,7 +295,7 @@ export type AddHumanUserData = {
export async function addHumanUser(
server: ZitadelServer,
- { email, firstName, lastName, password, organization }: AddHumanUserData
+ { email, firstName, lastName, password, organization }: AddHumanUserData,
): Promise {
const userService = user.getUser(server);
@@ -316,14 +316,14 @@ export async function addHumanUser(
password: { password },
}
: payload,
- {}
+ {},
);
}
export async function verifyTOTPRegistration(
code: string,
userId: string,
- token?: string
+ token?: string,
): Promise {
let userService;
if (token) {
@@ -342,7 +342,7 @@ export async function verifyTOTPRegistration(
}
export async function getUserByID(
- userId: string
+ userId: string,
): Promise {
const userService = user.getUser(server);
@@ -351,7 +351,7 @@ export async function getUserByID(
export async function listUsers(
userName: string,
- organizationId: string
+ organizationId: string,
): Promise {
const userService = user.getUser(server);
@@ -380,12 +380,12 @@ export async function listUsers(
},
],
},
- {}
+ {},
);
}
export async function getOrgByDomain(
- domain: string
+ domain: string,
): Promise {
const mgmtService = management.getManagement(server);
return mgmtService.getOrgByDomainGlobal({ domain }, {});
@@ -393,7 +393,7 @@ export async function getOrgByDomain(
export async function startIdentityProviderFlow(
server: ZitadelServer,
- { idpId, urls }: StartIdentityProviderIntentRequest
+ { idpId, urls }: StartIdentityProviderIntentRequest,
): Promise {
const userService = user.getUser(server);
@@ -405,7 +405,7 @@ export async function startIdentityProviderFlow(
export async function retrieveIdentityProviderInformation(
server: ZitadelServer,
- { idpIntentId, idpIntentToken }: RetrieveIdentityProviderIntentRequest
+ { idpIntentId, idpIntentToken }: RetrieveIdentityProviderIntentRequest,
): Promise {
const userService = user.getUser(server);
@@ -417,7 +417,7 @@ export async function retrieveIdentityProviderInformation(
export async function getAuthRequest(
server: ZitadelServer,
- { authRequestId }: GetAuthRequestRequest
+ { authRequestId }: GetAuthRequestRequest,
): Promise {
const oidcService = oidc.getOidc(server);
@@ -428,7 +428,7 @@ export async function getAuthRequest(
export async function createCallback(
server: ZitadelServer,
- req: CreateCallbackRequest
+ req: CreateCallbackRequest,
): Promise {
const oidcService = oidc.getOidc(server);
@@ -438,7 +438,7 @@ export async function createCallback(
export async function verifyEmail(
server: ZitadelServer,
userId: string,
- verificationCode: string
+ verificationCode: string,
): Promise {
const userservice = user.getUser(server);
return userservice.verifyEmail(
@@ -446,7 +446,7 @@ export async function verifyEmail(
userId,
verificationCode,
},
- {}
+ {},
);
}
@@ -458,14 +458,14 @@ export async function verifyEmail(
*/
export async function setEmail(
server: ZitadelServer,
- userId: string
+ userId: string,
): Promise {
const userservice = user.getUser(server);
return userservice.setEmail(
{
userId,
},
- {}
+ {},
);
}
@@ -477,7 +477,7 @@ export async function setEmail(
*/
export async function createPasskeyRegistrationLink(
userId: string,
- token?: string
+ token?: string,
): Promise {
let userService;
if (token) {
@@ -508,7 +508,7 @@ export async function createPasskeyRegistrationLink(
*/
export async function registerU2F(
userId: string,
- domain: string
+ domain: string,
): Promise {
const userservice = user.getUser(server);
@@ -526,7 +526,7 @@ export async function registerU2F(
* @returns the newly set email
*/
export async function verifyU2FRegistration(
- request: VerifyU2FRegistrationRequest
+ request: VerifyU2FRegistrationRequest,
): Promise {
const userservice = user.getUser(server);
@@ -548,7 +548,7 @@ export async function verifyPasskeyRegistration(
[key: string]: any;
}
| undefined,
- userId: string
+ userId: string,
): Promise {
const userservice = user.getUser(server);
return userservice.verifyPasskeyRegistration(
@@ -558,7 +558,7 @@ export async function verifyPasskeyRegistration(
publicKeyCredential,
userId,
},
- {}
+ {},
);
}
@@ -571,7 +571,7 @@ export async function verifyPasskeyRegistration(
export async function registerPasskey(
userId: string,
code: { id: string; code: string },
- domain: string
+ domain: string,
): Promise {
const userservice = user.getUser(server);
return userservice.registerPasskey({
@@ -589,7 +589,7 @@ export async function registerPasskey(
* @returns the newly set email
*/
export async function listAuthenticationMethodTypes(
- userId: string
+ userId: string,
): Promise {
const userservice = user.getUser(server);
return userservice.listAuthenticationMethodTypes({
diff --git a/apps/login/middleware.ts b/apps/login/src/middleware.ts
similarity index 100%
rename from apps/login/middleware.ts
rename to apps/login/src/middleware.ts
diff --git a/apps/login/styles/globals.scss b/apps/login/src/styles/globals.scss
similarity index 100%
rename from apps/login/styles/globals.scss
rename to apps/login/src/styles/globals.scss
diff --git a/apps/login/styles/vars.scss b/apps/login/src/styles/vars.scss
similarity index 100%
rename from apps/login/styles/vars.scss
rename to apps/login/src/styles/vars.scss
diff --git a/apps/login/ui/AddressBar.tsx b/apps/login/src/ui/AddressBar.tsx
similarity index 100%
rename from apps/login/ui/AddressBar.tsx
rename to apps/login/src/ui/AddressBar.tsx
diff --git a/apps/login/ui/Alert.tsx b/apps/login/src/ui/Alert.tsx
similarity index 99%
rename from apps/login/ui/Alert.tsx
rename to apps/login/src/ui/Alert.tsx
index 4c246c03..b6a093ba 100644
--- a/apps/login/ui/Alert.tsx
+++ b/apps/login/src/ui/Alert.tsx
@@ -29,7 +29,7 @@ export default function Alert({ children, type = AlertType.ALERT }: Props) {
{
[yellow]: type === AlertType.ALERT,
[neutral]: type === AlertType.INFO,
- }
+ },
)}
>
{type === AlertType.ALERT && (
diff --git a/apps/login/ui/AuthMethods.tsx b/apps/login/src/ui/AuthMethods.tsx
similarity index 96%
rename from apps/login/ui/AuthMethods.tsx
rename to apps/login/src/ui/AuthMethods.tsx
index aa204a23..10893997 100644
--- a/apps/login/ui/AuthMethods.tsx
+++ b/apps/login/src/ui/AuthMethods.tsx
@@ -9,7 +9,7 @@ const cardClasses = (alreadyAdded: boolean) =>
"relative bg-background-light-400 dark:bg-background-dark-400 group block space-y-1.5 rounded-md px-5 py-3 border border-divider-light dark:border-divider-dark transition-all ",
alreadyAdded
? "opacity-50 cursor-default"
- : "hover:shadow-lg hover:dark:bg-white/10"
+ : "hover:shadow-lg hover:dark:bg-white/10",
);
const LinkWrapper = ({
@@ -36,7 +36,7 @@ export const TOTP = (alreadyAdded: boolean, link: string) => {