Skip to content

Commit 2e3c1a8

Browse files
committed
chore: move app code into src dir
1 parent cd1cbe4 commit 2e3c1a8

File tree

104 files changed

+518
-480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+518
-480
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ jobs:
3030
with:
3131
version: 8
3232

33-
- name: Setup Node.js 18.x
33+
- name: Setup Node.js 20.x
3434
uses: actions/setup-node@v3
3535
with:
36-
node-version: 18.x
36+
node-version: 20.x
3737

3838
- uses: pnpm/action-setup@v2
3939
name: Install pnpm

apps/login/__test__/PasswordComplexity.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { render, screen, waitFor, within } from "@testing-library/react";
2-
import PasswordComplexity from "../ui/PasswordComplexity";
2+
import PasswordComplexity from "@/ui/PasswordComplexity";
33
// TODO: Why does this not compile?
44
// import { ResourceOwnerType } from '@zitadel/server';
55

@@ -30,14 +30,14 @@ describe("<PasswordComplexity/>", () => {
3030
requiresSymbol: false,
3131
resourceOwnerType: 0, // ResourceOwnerType.RESOURCE_OWNER_TYPE_UNSPECIFIED,
3232
}}
33-
/>
33+
/>,
3434
);
3535
});
3636
if (expectSVGTitle === false) {
3737
it(`should not render the feedback element`, async () => {
3838
await waitFor(() => {
3939
expect(
40-
screen.queryByText(feedbackElementLabel)
40+
screen.queryByText(feedbackElementLabel),
4141
).not.toBeInTheDocument();
4242
});
4343
});
@@ -46,12 +46,12 @@ describe("<PasswordComplexity/>", () => {
4646
await waitFor(async () => {
4747
const svg = within(
4848
screen.getByText(feedbackElementLabel)
49-
.parentElement as HTMLElement
49+
.parentElement as HTMLElement,
5050
).findByRole("img");
5151
expect(await svg).toHaveTextContent(expectSVGTitle);
5252
});
5353
});
5454
}
55-
}
55+
},
5656
);
5757
});

apps/login/cypress/integration/login.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ describe("login", () => {
111111
cy.get('button[type="submit"]').click();
112112
cy.location("pathname", { timeout: 10_000 }).should(
113113
"eq",
114-
"/passkey/add"
114+
"/passkey/add",
115115
);
116116
});
117117
});
@@ -160,7 +160,7 @@ describe("login", () => {
160160
cy.visit("/loginname?loginName=john%40zitadel.com&submit=true");
161161
cy.location("pathname", { timeout: 10_000 }).should(
162162
"eq",
163-
"/passkey/login"
163+
"/passkey/login",
164164
);
165165
});
166166
});

apps/login/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"tinycolor2": "1.4.2"
5555
},
5656
"devDependencies": {
57+
"@zitadel/prettier-config": "workspace:*",
5758
"@bufbuild/buf": "^1.14.0",
5859
"@jest/types": "^29.5.0",
5960
"@testing-library/jest-dom": "^5.16.5",

apps/login/prettier.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from "@zitadel/prettier-config";

apps/login/readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# ZITADEL Login UI
22

3-
This is going to be our next UI for the hosted login. It's based on Next.js 13 and its introduced `app/` directory.
3+
This is going to be our next UI for the hosted login. It's based on Next.js 13 and its introduced `app/` directory.
44

55
The Login UI should provide the following functionality:
66

7-
- **Login API:** Uses the new ZITADEL Login API
8-
- **Server Components:** Making server-first components
7+
- **Login API:** Uses the new ZITADEL Login API
8+
- **Server Components:** Making server-first components
99

1010
## Running Locally
1111

apps/login/app/(login)/accounts/page.tsx renamed to apps/login/src/app/(login)/accounts/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { Session } from "@zitadel/server";
2-
import { getBrandingSettings, listSessions, server } from "#/lib/zitadel";
3-
import { getAllSessionCookieIds } from "#/utils/cookies";
2+
import { getBrandingSettings, listSessions, server } from "@/lib/zitadel";
3+
import { getAllSessionCookieIds } from "@/utils/cookies";
44
import { UserPlusIcon } from "@heroicons/react/24/outline";
55
import Link from "next/link";
6-
import SessionsList from "#/ui/SessionsList";
7-
import DynamicTheme from "#/ui/DynamicTheme";
6+
import SessionsList from "@/ui/SessionsList";
7+
import DynamicTheme from "@/ui/DynamicTheme";
88

99
async function loadSessions(): Promise<Session[]> {
1010
const ids = await getAllSessionCookieIds();
1111

1212
if (ids && ids.length) {
1313
const response = await listSessions(
1414
server,
15-
ids.filter((id: string | undefined) => !!id)
15+
ids.filter((id: string | undefined) => !!id),
1616
);
1717
return response?.sessions ?? [];
1818
} else {

apps/login/app/(login)/error.tsx renamed to apps/login/src/app/(login)/error.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

3-
import { Boundary } from "#/ui/Boundary";
4-
import { Button } from "#/ui/Button";
3+
import { Boundary } from "@/ui/Boundary";
4+
import { Button } from "@/ui/Button";
55
import React from "react";
66

77
export default function Error({ error, reset }: any) {

apps/login/app/(login)/idp/[provider]/failure/page.tsx renamed to apps/login/src/app/(login)/idp/[provider]/failure/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { ProviderSlug } from "#/lib/demos";
2-
import { getBrandingSettings, server } from "#/lib/zitadel";
3-
import Alert, { AlertType } from "#/ui/Alert";
4-
import DynamicTheme from "#/ui/DynamicTheme";
5-
import IdpSignin from "#/ui/IdpSignin";
1+
import { ProviderSlug } from "@/lib/demos";
2+
import { getBrandingSettings, server } from "@/lib/zitadel";
3+
import Alert, { AlertType } from "@/ui/Alert";
4+
import DynamicTheme from "@/ui/DynamicTheme";
5+
import IdpSignin from "@/ui/IdpSignin";
66
import {
77
AddHumanUserRequest,
88
IDPInformation,

apps/login/app/(login)/idp/[provider]/success/page.tsx renamed to apps/login/src/app/(login)/idp/[provider]/success/page.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { ProviderSlug } from "#/lib/demos";
2-
import { getBrandingSettings, server } from "#/lib/zitadel";
3-
import Alert, { AlertType } from "#/ui/Alert";
4-
import DynamicTheme from "#/ui/DynamicTheme";
5-
import IdpSignin from "#/ui/IdpSignin";
1+
import { ProviderSlug } from "@/lib/demos";
2+
import { getBrandingSettings, server } from "@/lib/zitadel";
3+
import Alert, { AlertType } from "@/ui/Alert";
4+
import DynamicTheme from "@/ui/DynamicTheme";
5+
import IdpSignin from "@/ui/IdpSignin";
66
import {
77
AddHumanUserRequest,
88
IDPInformation,
@@ -63,18 +63,18 @@ const PROVIDER_MAPPING: {
6363

6464
function retrieveIDPIntent(
6565
id: string,
66-
token: string
66+
token: string,
6767
): Promise<RetrieveIdentityProviderIntentResponse> {
6868
const userService = user.getUser(server);
6969
return userService.retrieveIdentityProviderIntent(
7070
{ idpIntentId: id, idpIntentToken: token },
71-
{}
71+
{},
7272
);
7373
}
7474

7575
function createUser(
7676
provider: ProviderSlug,
77-
info: IDPInformation
77+
info: IDPInformation,
7878
): Promise<string> {
7979
const userData = PROVIDER_MAPPING[provider](info);
8080
const userService = user.getUser(server);

apps/login/app/(login)/idp/page.tsx renamed to apps/login/src/app/(login)/idp/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import {
22
getBrandingSettings,
33
getLegalAndSupportSettings,
44
server,
5-
} from "#/lib/zitadel";
6-
import DynamicTheme from "#/ui/DynamicTheme";
7-
import { SignInWithIDP } from "#/ui/SignInWithIDP";
5+
} from "@/lib/zitadel";
6+
import DynamicTheme from "@/ui/DynamicTheme";
7+
import { SignInWithIDP } from "@/ui/SignInWithIDP";
88
import {
99
GetActiveIdentityProvidersResponse,
1010
IdentityProvider,
@@ -14,13 +14,13 @@ import {
1414

1515
function getIdentityProviders(
1616
server: ZitadelServer,
17-
orgId?: string
17+
orgId?: string,
1818
): Promise<IdentityProvider[] | undefined> {
1919
const settingsService = settings.getSettings(server);
2020
return settingsService
2121
.getActiveIdentityProviders(
2222
orgId ? { ctx: { orgId } } : { ctx: { instance: true } },
23-
{}
23+
{},
2424
)
2525
.then((resp: GetActiveIdentityProvidersResponse) => {
2626
return resp.identityProviders;

apps/login/app/(login)/loginname/page.tsx renamed to apps/login/src/app/(login)/loginname/page.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import {
33
getLegalAndSupportSettings,
44
getLoginSettings,
55
server,
6-
} from "#/lib/zitadel";
7-
import DynamicTheme from "#/ui/DynamicTheme";
8-
import { SignInWithIDP } from "#/ui/SignInWithIDP";
9-
import UsernameForm from "#/ui/UsernameForm";
6+
} from "@/lib/zitadel";
7+
import DynamicTheme from "@/ui/DynamicTheme";
8+
import { SignInWithIDP } from "@/ui/SignInWithIDP";
9+
import UsernameForm from "@/ui/UsernameForm";
1010
import {
1111
GetActiveIdentityProvidersResponse,
1212
IdentityProvider,
@@ -16,13 +16,13 @@ import {
1616

1717
function getIdentityProviders(
1818
server: ZitadelServer,
19-
orgId?: string
19+
orgId?: string,
2020
): Promise<IdentityProvider[] | undefined> {
2121
const settingsService = settings.getSettings(server);
2222
return settingsService
2323
.getActiveIdentityProviders(
2424
orgId ? { ctx: { orgId } } : { ctx: { instance: true } },
25-
{}
25+
{},
2626
)
2727
.then((resp: GetActiveIdentityProvidersResponse) => {
2828
return resp.identityProviders;

apps/login/app/(login)/mfa/page.tsx renamed to apps/login/src/app/(login)/mfa/page.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import {
33
getSession,
44
listAuthenticationMethodTypes,
55
server,
6-
} from "#/lib/zitadel";
7-
import Alert from "#/ui/Alert";
8-
import ChooseSecondFactor from "#/ui/ChooseSecondFactor";
9-
import DynamicTheme from "#/ui/DynamicTheme";
10-
import UserAvatar from "#/ui/UserAvatar";
6+
} from "@/lib/zitadel";
7+
import Alert from "@/ui/Alert";
8+
import ChooseSecondFactor from "@/ui/ChooseSecondFactor";
9+
import DynamicTheme from "@/ui/DynamicTheme";
10+
import UserAvatar from "@/ui/UserAvatar";
1111
import {
1212
getMostRecentCookieWithLoginname,
1313
getSessionCookieById,
14-
} from "#/utils/cookies";
14+
} from "@/utils/cookies";
1515

1616
export default async function Page({
1717
searchParams,
@@ -27,16 +27,16 @@ export default async function Page({
2727

2828
async function loadSessionByLoginname(
2929
loginName?: string,
30-
organization?: string
30+
organization?: string,
3131
) {
3232
const recent = await getMostRecentCookieWithLoginname(
3333
loginName,
34-
organization
34+
organization,
3535
);
3636
return getSession(server, recent.id, recent.token).then((response) => {
3737
if (response?.session && response.session.factors?.user?.id) {
3838
return listAuthenticationMethodTypes(
39-
response.session.factors.user.id
39+
response.session.factors.user.id,
4040
).then((methods) => {
4141
return {
4242
factors: response.session?.factors,
@@ -52,7 +52,7 @@ export default async function Page({
5252
return getSession(server, recent.id, recent.token).then((response) => {
5353
if (response?.session && response.session.factors?.user?.id) {
5454
return listAuthenticationMethodTypes(
55-
response.session.factors.user.id
55+
response.session.factors.user.id,
5656
).then((methods) => {
5757
return {
5858
factors: response.session?.factors,

apps/login/app/(login)/mfa/set/page.tsx renamed to apps/login/src/app/(login)/mfa/set/page.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import {
55
getUserByID,
66
listAuthenticationMethodTypes,
77
server,
8-
} from "#/lib/zitadel";
9-
import Alert from "#/ui/Alert";
10-
import ChooseSecondFactorToSetup from "#/ui/ChooseSecondFactorToSetup";
11-
import DynamicTheme from "#/ui/DynamicTheme";
12-
import UserAvatar from "#/ui/UserAvatar";
8+
} from "@/lib/zitadel";
9+
import Alert from "@/ui/Alert";
10+
import ChooseSecondFactorToSetup from "@/ui/ChooseSecondFactorToSetup";
11+
import DynamicTheme from "@/ui/DynamicTheme";
12+
import UserAvatar from "@/ui/UserAvatar";
1313
import {
1414
getMostRecentCookieWithLoginname,
1515
getSessionCookieById,
16-
} from "#/utils/cookies";
16+
} from "@/utils/cookies";
1717
import { user } from "@zitadel/server";
1818

1919
export default async function Page({
@@ -30,11 +30,11 @@ export default async function Page({
3030

3131
async function loadSessionByLoginname(
3232
loginName?: string,
33-
organization?: string
33+
organization?: string,
3434
) {
3535
const recent = await getMostRecentCookieWithLoginname(
3636
loginName,
37-
organization
37+
organization,
3838
);
3939
return getSession(server, recent.id, recent.token).then((response) => {
4040
if (response?.session && response.session.factors?.user?.id) {

apps/login/app/(login)/otp/[method]/page.tsx renamed to apps/login/src/app/(login)/otp/[method]/page.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import {
33
getLoginSettings,
44
getSession,
55
server,
6-
} from "#/lib/zitadel";
7-
import Alert from "#/ui/Alert";
8-
import DynamicTheme from "#/ui/DynamicTheme";
9-
import LoginOTP from "#/ui/LoginOTP";
10-
import UserAvatar from "#/ui/UserAvatar";
11-
import { getMostRecentCookieWithLoginname } from "#/utils/cookies";
6+
} from "@/lib/zitadel";
7+
import Alert from "@/ui/Alert";
8+
import DynamicTheme from "@/ui/DynamicTheme";
9+
import LoginOTP from "@/ui/LoginOTP";
10+
import UserAvatar from "@/ui/UserAvatar";
11+
import { getMostRecentCookieWithLoginname } from "@/utils/cookies";
1212

1313
export default async function Page({
1414
searchParams,
@@ -29,7 +29,7 @@ export default async function Page({
2929
async function loadSession(loginName?: string, organization?: string) {
3030
const recent = await getMostRecentCookieWithLoginname(
3131
loginName,
32-
organization
32+
organization,
3333
);
3434

3535
return getSession(server, recent.id, recent.token).then((response) => {

apps/login/app/(login)/otp/[method]/set/page.tsx renamed to apps/login/src/app/(login)/otp/[method]/set/page.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import {
55
getSession,
66
registerTOTP,
77
server,
8-
} from "#/lib/zitadel";
9-
import Alert from "#/ui/Alert";
10-
import { Button, ButtonVariants } from "#/ui/Button";
11-
import DynamicTheme from "#/ui/DynamicTheme";
12-
import { Spinner } from "#/ui/Spinner";
13-
import TOTPRegister from "#/ui/TOTPRegister";
14-
import UserAvatar from "#/ui/UserAvatar";
15-
import { getMostRecentCookieWithLoginname } from "#/utils/cookies";
8+
} from "@/lib/zitadel";
9+
import Alert from "@/ui/Alert";
10+
import { Button, ButtonVariants } from "@/ui/Button";
11+
import DynamicTheme from "@/ui/DynamicTheme";
12+
import { Spinner } from "@/ui/Spinner";
13+
import TOTPRegister from "@/ui/TOTPRegister";
14+
import UserAvatar from "@/ui/UserAvatar";
15+
import { getMostRecentCookieWithLoginname } from "@/utils/cookies";
1616
import { RegisterTOTPResponse } from "@zitadel/server";
1717
import Link from "next/link";
1818
import { ClientError } from "nice-grpc";
@@ -60,7 +60,7 @@ export default async function Page({
6060
async function loadSession(loginName?: string, organization?: string) {
6161
const recent = await getMostRecentCookieWithLoginname(
6262
loginName,
63-
organization
63+
organization,
6464
);
6565

6666
return getSession(server, recent.id, recent.token).then((response) => {
@@ -149,8 +149,8 @@ export default async function Page({
149149
{method === "email"
150150
? "Code via email was successfully added."
151151
: method === "sms"
152-
? "Code via SMS was successfully added."
153-
: ""}
152+
? "Code via SMS was successfully added."
153+
: ""}
154154
</p>
155155

156156
<div className="mt-8 flex w-full flex-row items-center">

0 commit comments

Comments
 (0)