-
Couldn't load subscription status.
- Fork 7
[DRIZZ-32,DRIZZ-31] Login and Sign Up page #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: df47273 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements basic authentication for login and sign up, along with guarding collection pages based on user permissions. Key changes include updating authentication handlers and endpoints, integrating serverFunction into Next.js layouts, and refining type and cookie handling for sessions.
Reviewed Changes
Copilot reviewed 70 out of 70 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/builder.handler.ts | Updates field property references to remove the underscore prefix. |
| packages/core/src/auth/utils.ts | Refactors cookie handling with the new cookie-es package and updates getSessionCookie. |
| packages/core/src/auth/index.ts | Updates table types and introduces getAuthClient with enhanced type definitions. |
| packages/core/src/auth/handlers/sign-up.ts | Implements password length validation and adds secure cookie header in the response. |
| packages/core/src/auth/handlers/login-email.ts | Renames signInEmail to loginEmail and updates session creation to use account.user.id. |
| packages/core/src/auth/handlers/index.ts | Updates handler mapping for login to use the new loginEmail function. |
| packages/core/src/auth/context.ts | Modifies session retrieval to use tokens and renames findUserBySessionId accordingly. |
| packages/core/src/mocks/complex-schema.ts | Adjusts mock schema to use uuid with default random generation instead of text. |
| packages/core/package.json | Adds dependencies for cookie-es, zod-to-json-schema, and @types/json-schema. |
| examples/erp/src/app/(admin)/api/[...segments]/route.ts | Switches from createApiResourceRouter to using serverConfig.resourceRouter. |
| examples/erp/src/app/(admin)/admin/layout.ts | Updates import paths and adds serverFunction to the layout configuration. |
| examples/erp/src/app/(admin)/admin/[...segments]/page.tsx | Adds serverFunction property to the RootPage for proper configuration. |
| examples/erp/drizzlify/helper.ts | Enables logging on the drizzle client configuration for debugging. |
| examples/erp/drizzlify/config.ts | Adopts Next.js server config by composing with defineNextJsServerConfig. |
| examples/erp/drizzle/meta and schema files | Updates database schema and migration files to use uuid defaults. |
| .vscode/settings.json & .changeset/polite-games-help.md | Minor configuration and changelog updates. |
Comments suppressed due to low confidence (2)
packages/core/src/auth/handlers/login-email.ts:45
- Replace the current password comparison logic with a proper hashing mechanism to securely compare the submitted password with the stored hash.
if (account.password !== hashPassword) {
packages/core/src/auth/index.ts:22
- Confirm that switching to an auto-generated UUID (using WithHasDefault) for the 'id' field does not conflict with any downstream logic that might expect manual ID assignment.
id: WithHasDefault<WithNotNull<AnyTypedColumn<string>>>,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
packages/core/src/auth/index.ts
Outdated
| } | ||
| emailAndPassword?: { | ||
| enabled: boolean | ||
| passwordHasher?: (password: string) => Promise<string> // default: bcrypt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| passwordHasher?: (password: string) => Promise<string> // default: bcrypt | |
| passwordHasher?: (password: string) => Promise<string> // default: scrypt |

Why I did
What I did
serverFunctionfield_.fieldNametofield.fieldNameNextJsServerConfigwhich enhance serverConfig fromcorepackageJSONSchema7specification. (serializezodtoJSONSchema7)