From 95fec9dcf3639b7c26ea1d8102881606cbaedc8e Mon Sep 17 00:00:00 2001 From: Yordis Prieto Date: Fri, 12 Apr 2024 23:00:49 -0400 Subject: [PATCH] chore: upgrade pnpm, pkgs, and fix format --- .github/workflows/test.yml | 4 +- .prettierignore | 3 + CONTRIBUTING.md | 2 +- README.md | 34 +- .../__test__/PasswordComplexity.test.tsx | 8 +- apps/login/app/(login)/accounts/page.tsx | 2 +- .../(login)/idp/[provider]/success/page.tsx | 6 +- apps/login/app/(login)/idp/page.tsx | 4 +- apps/login/app/(login)/loginname/page.tsx | 4 +- apps/login/app/(login)/passkey/add/page.tsx | 2 +- apps/login/app/(login)/passkey/login/page.tsx | 4 +- apps/login/app/(login)/password/page.tsx | 2 +- apps/login/app/(login)/register/page.tsx | 2 +- apps/login/app/api/loginname/route.ts | 4 +- apps/login/app/api/passkeys/route.ts | 4 +- apps/login/app/api/passkeys/verify/route.ts | 6 +- apps/login/app/api/registeruser/route.ts | 2 +- apps/login/app/api/session/route.ts | 28 +- apps/login/app/login/route.ts | 24 +- apps/login/cypress/integration/login.cy.ts | 4 +- apps/login/lib/zitadel.ts | 76 +- apps/login/package.json | 2 +- apps/login/tailwind.config.js | 10 +- apps/login/ui/Alert.tsx | 2 +- apps/login/ui/Avatar.tsx | 8 +- apps/login/ui/Boundary.tsx | 2 +- apps/login/ui/Button.tsx | 6 +- apps/login/ui/Checkbox.tsx | 6 +- apps/login/ui/GlobalNav.tsx | 4 +- apps/login/ui/IdpSignin.tsx | 6 +- apps/login/ui/Input.tsx | 4 +- apps/login/ui/LoginPasskey.tsx | 22 +- apps/login/ui/MobileNavToggle.tsx | 2 +- apps/login/ui/PasswordForm.tsx | 2 +- apps/login/ui/RegisterFormWithoutPassword.tsx | 4 +- apps/login/ui/RegisterPasskey.tsx | 14 +- apps/login/ui/SessionItem.tsx | 4 +- apps/login/ui/SignInWithIDP.tsx | 4 +- apps/login/ui/UsernameForm.tsx | 16 +- apps/login/utils/colors.ts | 24 +- apps/login/utils/cookies.ts | 34 +- apps/login/utils/session.ts | 28 +- package.json | 17 +- packages/zitadel-client/jest.config.ts | 10 +- packages/zitadel-client/package.json | 6 +- packages/zitadel-client/src/app.ts | 6 +- .../zitadel-client/src/middleware.test.ts | 113 +- packages/zitadel-client/src/middleware.ts | 2 +- packages/zitadel-next/jest.config.ts | 10 +- packages/zitadel-next/package.json | 6 +- packages/zitadel-react/jest.config.ts | 12 +- packages/zitadel-react/package.json | 6 +- .../src/components/SignInWithAzureAD.tsx | 2 +- .../src/components/SignInWithGithub.tsx | 2 +- .../src/components/SignInWithGitlab.tsx | 2 +- .../src/components/SignInWithGoogle.tsx | 2 +- packages/zitadel-server/jest.config.ts | 10 +- packages/zitadel-server/package.json | 28 +- packages/zitadel-server/src/admin/admin.ts | 4 +- packages/zitadel-server/src/auth/auth.ts | 4 +- .../src/management/management.ts | 4 +- .../zitadel-server/src/middleware.test.ts | 113 +- packages/zitadel-server/src/middleware.ts | 11 +- packages/zitadel-server/src/server.ts | 4 +- packages/zitadel-server/src/system/system.ts | 4 +- packages/zitadel-server/src/v2/oidc/oidc.ts | 2 +- .../zitadel-server/src/v2/session/session.ts | 2 +- .../src/v2/settings/settings.ts | 2 +- packages/zitadel-server/src/v2/user/user.ts | 2 +- pnpm-lock.yaml | 10161 ++++++---------- 70 files changed, 4043 insertions(+), 6933 deletions(-) create mode 100644 .prettierignore diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 381501b88..a417bfcdc 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/.prettierignore b/.prettierignore new file mode 100644 index 000000000..21b8f2261 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +.next/ +dist/ +**/src/proto/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 44e0914bd..18038ed32 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -57,6 +57,7 @@ export $(cat ./apps/login/.env.acceptance | xargs) ### Developing Against Your ZITADEL Cloud Instance Configure your shell by exporting the following environment variables: + ```sh export ZITADEL_API_URL= export ZITADEL_ORG_ID= @@ -93,5 +94,4 @@ In apps/login, these commands also spin up the application and a ZITADEL gRPC AP If you want to run the integration tests standalone against an environment of your choice, navigate to ./apps/login, [configure your shell as you like](# Developing Against Your ZITADEL Cloud Instance) and run `pnpm test:integration:run` or `pnpm test:integration:open`. Then you need to lifecycle the mock process using the command `pnpm mock` or the more fine grained commands `pnpm mock:build`, `pnpm mock:build:nocache`, `pnpm mock:run` and `pnpm mock:destroy`. - That's it! 🎉 diff --git a/README.md b/README.md index 9a3203742..ebbdac265 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Each package and app is 100% [TypeScript](https://www.typescriptlang.org/). ### Login -The login is currently in a work in progress state. +The login is currently in a work in progress state. The goal is to implement a login UI, using the session API of ZITADEL, which also implements the OIDC Standard and is ready to use for everyone. In the first phase we want to have a MVP login ready with the OIDC Standard and a basic feature set. In a second step the features will be extended. @@ -45,7 +45,7 @@ This list should show the current implementation state, and also what is missing You can already use the current state, and extend it with your needs. - [x] Local User Registration (with Password) -- [ ] User Registration and Login with external Provider +- [ ] User Registration and Login with external Provider - [ ] Google - [ ] GitHub - [ ] GitHub Enterprise @@ -67,21 +67,21 @@ You can already use the current state, and extend it with your needs. - [ ] Domain Discovery - [ ] Branding - OIDC Standard - - [ ] Authorization Code Flow with PKCE - - [ ] AuthRequest `hintUserId` - - [ ] AuthRequest `loginHint` - - [ ] AuthRequest `prompt` - - [x] Login - - [x] Select Account - - [ ] Consent - - [ ] Create - - Scopes - - [ ] `openid email profile address`` - - [ ] `offline access` - - [ ] `urn:zitadel:iam:org:idp:id:{idp_id}` - - [ ] `urn:zitadel:iam:org:project:id:zitadel:aud` - - [ ] `urn:zitadel:iam:org:id:{orgid}` - - [ ] AuthRequest UI locales + - [ ] Authorization Code Flow with PKCE + - [ ] AuthRequest `hintUserId` + - [ ] AuthRequest `loginHint` + - [ ] AuthRequest `prompt` + - [x] Login + - [x] Select Account + - [ ] Consent + - [ ] Create + - Scopes + - [ ] `openid email profile address`` + - [ ] `offline access` + - [ ] `urn:zitadel:iam:org:idp:id:{idp_id}` + - [ ] `urn:zitadel:iam:org:project:id:zitadel:aud` + - [ ] `urn:zitadel:iam:org:id:{orgid}` + - [ ] AuthRequest UI locales ## Tooling diff --git a/apps/login/__test__/PasswordComplexity.test.tsx b/apps/login/__test__/PasswordComplexity.test.tsx index b22168179..a8917bb39 100644 --- a/apps/login/__test__/PasswordComplexity.test.tsx +++ b/apps/login/__test__/PasswordComplexity.test.tsx @@ -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/app/(login)/accounts/page.tsx b/apps/login/app/(login)/accounts/page.tsx index 6985ea67f..f421aca0a 100644 --- a/apps/login/app/(login)/accounts/page.tsx +++ b/apps/login/app/(login)/accounts/page.tsx @@ -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)/idp/[provider]/success/page.tsx b/apps/login/app/(login)/idp/[provider]/success/page.tsx index 6aae35bf6..930b27865 100644 --- a/apps/login/app/(login)/idp/[provider]/success/page.tsx +++ b/apps/login/app/(login)/idp/[provider]/success/page.tsx @@ -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/app/(login)/idp/page.tsx index c1da21788..5414825f2 100644 --- a/apps/login/app/(login)/idp/page.tsx +++ b/apps/login/app/(login)/idp/page.tsx @@ -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/app/(login)/loginname/page.tsx index b85a8a09f..9c525b751 100644 --- a/apps/login/app/(login)/loginname/page.tsx +++ b/apps/login/app/(login)/loginname/page.tsx @@ -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)/passkey/add/page.tsx b/apps/login/app/(login)/passkey/add/page.tsx index 839ac2225..c083d11f4 100644 --- a/apps/login/app/(login)/passkey/add/page.tsx +++ b/apps/login/app/(login)/passkey/add/page.tsx @@ -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/app/(login)/passkey/login/page.tsx index bcc366465..1e31d7dcb 100644 --- a/apps/login/app/(login)/passkey/login/page.tsx +++ b/apps/login/app/(login)/passkey/login/page.tsx @@ -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/app/(login)/password/page.tsx index 9e4825749..5efed1144 100644 --- a/apps/login/app/(login)/password/page.tsx +++ b/apps/login/app/(login)/password/page.tsx @@ -17,7 +17,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/app/(login)/register/page.tsx index 506b9df07..5f42c9639 100644 --- a/apps/login/app/(login)/register/page.tsx +++ b/apps/login/app/(login)/register/page.tsx @@ -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/api/loginname/route.ts b/apps/login/app/api/loginname/route.ts index 8b559e1f6..307eab861 100644 --- a/apps/login/app/api/loginname/route.ts +++ b/apps/login/app/api/loginname/route.ts @@ -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/passkeys/route.ts b/apps/login/app/api/passkeys/route.ts index 559902621..b76b428c6 100644 --- a/apps/login/app/api/passkeys/route.ts +++ b/apps/login/app/api/passkeys/route.ts @@ -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/app/api/passkeys/verify/route.ts index 1346ecc63..41e53ac22 100644 --- a/apps/login/app/api/passkeys/verify/route.ts +++ b/apps/login/app/api/passkeys/verify/route.ts @@ -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/app/api/registeruser/route.ts index 575396143..eedf0bab3 100644 --- a/apps/login/app/api/registeruser/route.ts +++ b/apps/login/app/api/registeruser/route.ts @@ -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/session/route.ts b/apps/login/app/api/session/route.ts index 63f1f08e2..a06e977e6 100644 --- a/apps/login/app/api/session/route.ts +++ b/apps/login/app/api/session/route.ts @@ -31,7 +31,7 @@ export async function POST(request: NextRequest) { userId, idpIntent, organization, - authRequestId + authRequestId, ).then((session) => { return NextResponse.json(session); }); @@ -41,7 +41,7 @@ export async function POST(request: NextRequest) { password, undefined, organization, - authRequestId + authRequestId, ).then((session) => { return NextResponse.json(session); }); @@ -49,7 +49,7 @@ export async function POST(request: NextRequest) { } else { return NextResponse.json( { details: "Session could not be created" }, - { status: 500 } + { status: 500 }, ); } } @@ -78,12 +78,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; @@ -98,7 +100,7 @@ export async function PUT(request: NextRequest) { password, webAuthN, challenges, - authRequestId + authRequestId, ).then((session) => { return NextResponse.json({ sessionId: session.id, @@ -113,7 +115,7 @@ export async function PUT(request: NextRequest) { } else { return NextResponse.json( { details: "Request body is missing" }, - { status: 400 } + { status: 400 }, ); } } @@ -137,14 +139,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/login/route.ts b/apps/login/app/login/route.ts index 10516eec3..0fc651500 100644 --- a/apps/login/app/login/route.ts +++ b/apps/login/app/login/route.ts @@ -12,7 +12,7 @@ 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) { @@ -55,7 +55,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); @@ -63,7 +63,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) { @@ -90,7 +90,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) { @@ -98,7 +98,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) { @@ -157,7 +157,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) { @@ -173,13 +173,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 { @@ -188,7 +188,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) { @@ -236,7 +236,7 @@ export async function GET(request: NextRequest) { } else { return NextResponse.json( { error: "No authRequestId provided" }, - { status: 500 } + { status: 500 }, ); } } diff --git a/apps/login/cypress/integration/login.cy.ts b/apps/login/cypress/integration/login.cy.ts index 91d1cd72d..206d74b4b 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/lib/zitadel.ts b/apps/login/lib/zitadel.ts index edaf9cc36..d3e87d430 100644 --- a/apps/login/lib/zitadel.ts +++ b/apps/login/lib/zitadel.ts @@ -57,20 +57,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 @@ -79,7 +79,7 @@ export async function getLoginSettings( } export async function getGeneralSettings( - server: ZitadelServer + server: ZitadelServer, ): Promise { const settingsService = settings.getSettings(server); return settingsService @@ -89,13 +89,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; @@ -104,7 +104,7 @@ export async function getLegalAndSupportSettings( export async function getPasswordComplexitySettings( server: ZitadelServer, - organization?: string + organization?: string, ): Promise { const settingsService = settings.getSettings(server); @@ -113,7 +113,7 @@ export async function getPasswordComplexitySettings( organization ? { ctx: { orgId: organization } } : { ctx: { instance: true } }, - {} + {}, ) .then((resp: GetPasswordComplexitySettingsResponse) => resp.settings); } @@ -122,7 +122,7 @@ export async function createSessionForLoginname( server: ZitadelServer, loginName: string, password: string | undefined, - challenges: RequestChallenges | undefined + challenges: RequestChallenges | undefined, ): Promise { const sessionService = session.getSession(server); return password @@ -135,7 +135,7 @@ export async function createSessionForLoginname( nanos: 0, }, }, - {} + {}, ) : sessionService.createSession( { @@ -146,7 +146,7 @@ export async function createSessionForLoginname( nanos: 0, }, }, - {} + {}, ); } @@ -154,7 +154,7 @@ export async function createSessionForUserId( server: ZitadelServer, userId: string, password: string | undefined, - challenges: RequestChallenges | undefined + challenges: RequestChallenges | undefined, ): Promise { const sessionService = session.getSession(server); return password @@ -167,7 +167,7 @@ export async function createSessionForUserId( nanos: 0, }, }, - {} + {}, ) : sessionService.createSession( { @@ -178,7 +178,7 @@ export async function createSessionForUserId( nanos: 0, }, }, - {} + {}, ); } @@ -188,7 +188,7 @@ export async function createSessionForUserIdAndIdpIntent( idpIntent: { idpIntentId?: string | undefined; idpIntentToken?: string | undefined; - } + }, ): Promise { const sessionService = session.getSession(server); @@ -200,7 +200,7 @@ export async function createSessionForUserIdAndIdpIntent( // nanos: 0, // }, }, - {} + {}, ); } @@ -210,7 +210,7 @@ export async function setSession( sessionToken: string, password: string | undefined, webAuthN: { credentialAssertionData: any } | undefined, - challenges: RequestChallenges | undefined + challenges: RequestChallenges | undefined, ): Promise { const sessionService = session.getSession(server); @@ -236,7 +236,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 }, {}); @@ -245,7 +245,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 }, {}); @@ -253,7 +253,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 }; @@ -271,7 +271,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); @@ -292,13 +292,13 @@ export async function addHumanUser( password: { password }, } : payload, - {} + {}, ); } export async function listUsers( userName: string, - organizationId: string + organizationId: string, ): Promise { const userService = user.getUser(server); @@ -327,12 +327,12 @@ export async function listUsers( }, ], }, - {} + {}, ); } export async function getOrgByDomain( - domain: string + domain: string, ): Promise { const mgmtService = management.getManagement(server); return mgmtService.getOrgByDomainGlobal({ domain }, {}); @@ -340,7 +340,7 @@ export async function getOrgByDomain( export async function startIdentityProviderFlow( server: ZitadelServer, - { idpId, urls }: StartIdentityProviderIntentRequest + { idpId, urls }: StartIdentityProviderIntentRequest, ): Promise { const userService = user.getUser(server); @@ -352,7 +352,7 @@ export async function startIdentityProviderFlow( export async function retrieveIdentityProviderInformation( server: ZitadelServer, - { idpIntentId, idpIntentToken }: RetrieveIdentityProviderIntentRequest + { idpIntentId, idpIntentToken }: RetrieveIdentityProviderIntentRequest, ): Promise { const userService = user.getUser(server); @@ -364,7 +364,7 @@ export async function retrieveIdentityProviderInformation( export async function getAuthRequest( server: ZitadelServer, - { authRequestId }: GetAuthRequestRequest + { authRequestId }: GetAuthRequestRequest, ): Promise { const oidcService = oidc.getOidc(server); @@ -375,7 +375,7 @@ export async function getAuthRequest( export async function createCallback( server: ZitadelServer, - req: CreateCallbackRequest + req: CreateCallbackRequest, ): Promise { const oidcService = oidc.getOidc(server); @@ -385,7 +385,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( @@ -393,7 +393,7 @@ export async function verifyEmail( userId, verificationCode, }, - {} + {}, ); } @@ -405,14 +405,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, }, - {} + {}, ); } @@ -423,7 +423,7 @@ export async function setEmail( * @returns the newly set email */ export async function createPasskeyRegistrationLink( - userId: string + userId: string, ): Promise { const userservice = user.getUser(server); @@ -448,7 +448,7 @@ export async function verifyPasskeyRegistration( [key: string]: any; } | undefined, - userId: string + userId: string, ): Promise { const userservice = user.getUser(server); return userservice.verifyPasskeyRegistration( @@ -458,7 +458,7 @@ export async function verifyPasskeyRegistration( publicKeyCredential, userId, }, - {} + {}, ); } @@ -471,7 +471,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({ @@ -489,7 +489,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/package.json b/apps/login/package.json index 8f4925802..eea8182d1 100644 --- a/apps/login/package.json +++ b/apps/login/package.json @@ -86,7 +86,7 @@ "ts-jest": "^29.1.0", "ts-node": "^10.9.1", "ts-proto": "^1.139.0", - "typescript": "5.0.4", + "typescript": "^5.4.5", "zitadel-tailwind-config": "workspace:*" } } diff --git a/apps/login/tailwind.config.js b/apps/login/tailwind.config.js index c7ef01f23..7c1709cf1 100644 --- a/apps/login/tailwind.config.js +++ b/apps/login/tailwind.config.js @@ -25,12 +25,10 @@ types.forEach((type) => { themes.forEach((theme) => { shades.forEach((shade) => { colors[type][theme][shade] = `var(--theme-${theme}-${type}-${shade})`; - colors[type][theme][ - `contrast-${shade}` - ] = `var(--theme-${theme}-${type}-contrast-${shade})`; - colors[type][theme][ - `secondary-${shade}` - ] = `var(--theme-${theme}-${type}-secondary-${shade})`; + colors[type][theme][`contrast-${shade}`] = + `var(--theme-${theme}-${type}-contrast-${shade})`; + colors[type][theme][`secondary-${shade}`] = + `var(--theme-${theme}-${type}-secondary-${shade})`; }); }); }); diff --git a/apps/login/ui/Alert.tsx b/apps/login/ui/Alert.tsx index c5bf05ea8..41cd3f06a 100644 --- a/apps/login/ui/Alert.tsx +++ b/apps/login/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/Avatar.tsx b/apps/login/ui/Avatar.tsx index 096f97de3..4cca0b100 100644 --- a/apps/login/ui/Avatar.tsx +++ b/apps/login/ui/Avatar.tsx @@ -69,10 +69,10 @@ export function Avatar({ size === "large" ? "h-20 w-20 font-normal" : size === "base" - ? "w-[38px] h-[38px] font-bold" - : size === "small" - ? "w-[32px] h-[32px] font-bold text-[13px]" - : "" + ? "w-[38px] h-[38px] font-bold" + : size === "small" + ? "w-[32px] h-[32px] font-bold text-[13px]" + : "" }`} style={resolvedTheme === "light" ? avatarStyleLight : avatarStyleDark} > diff --git a/apps/login/ui/Boundary.tsx b/apps/login/ui/Boundary.tsx index ebfa0c6b6..c7487df1a 100644 --- a/apps/login/ui/Boundary.tsx +++ b/apps/login/ui/Boundary.tsx @@ -61,7 +61,7 @@ export const Boundary = ({ { "left-3 lg:left-5": size === "small", "left-4 lg:left-9": size === "default", - } + }, )} > {labels.map((label) => { diff --git a/apps/login/ui/Button.tsx b/apps/login/ui/Button.tsx index f76d11ccb..e16a6a698 100644 --- a/apps/login/ui/Button.tsx +++ b/apps/login/ui/Button.tsx @@ -35,7 +35,7 @@ export type ButtonProps = DetailedHTMLProps< export const getButtonClasses = ( size: ButtonSizes, variant: ButtonVariants, - color: ButtonColors + color: ButtonColors, ) => clsx({ "box-border font-normal leading-36px text-14px inline-flex items-center rounded-md focus:outline-none transition-colors transition-shadow duration-300": @@ -65,7 +65,7 @@ export const Button = forwardRef( color = ButtonColors.Primary, ...props }, - ref + ref, ) => ( - ) + ), ); diff --git a/apps/login/ui/Checkbox.tsx b/apps/login/ui/Checkbox.tsx index f5e8beb95..5e56093b2 100644 --- a/apps/login/ui/Checkbox.tsx +++ b/apps/login/ui/Checkbox.tsx @@ -26,7 +26,7 @@ export const Checkbox = forwardRef( children, ...props }, - ref + ref, ) => { const [enabled, setEnabled] = useState(checked); @@ -53,7 +53,7 @@ export const Checkbox = forwardRef( "focus:border-gray-500 focus:dark:border-white focus:ring-opacity-40 focus:dark:ring-opacity-40 focus:ring-offset-0 focus:ring-2 dark:focus:ring-offset-0 dark:focus:ring-2 focus:ring-gray-500 focus:dark:ring-white", "h-4 w-4 rounded-sm ring-0 outline-0 checked:ring-0 checked:dark:ring-0 active:border-none active:ring-0", "disabled:bg-gray-500 disabled:text-gray-500 disabled:border-gray-200 disabled:cursor-not-allowed", - className + className, )} {...props} /> @@ -61,5 +61,5 @@ export const Checkbox = forwardRef( {children} ); - } + }, ); diff --git a/apps/login/ui/GlobalNav.tsx b/apps/login/ui/GlobalNav.tsx index d24864ff0..0b5bb32d8 100644 --- a/apps/login/ui/GlobalNav.tsx +++ b/apps/login/ui/GlobalNav.tsx @@ -56,7 +56,7 @@ export function GlobalNav() { "fixed inset-x-0 bottom-0 top-14 mt-px bg-white/80 dark:bg-black/80 backdrop-blur-lg": isOpen, hidden: !isOpen, - } + }, )} >