-
Notifications
You must be signed in to change notification settings - Fork 2
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
passwordログイン #61
passwordログイン #61
Conversation
### ウォークスルー
この変更セットは、Googleログインの設定手順を削除し、開発環境用の簡易認証方法を追加しています。また、フォームベースの認証機能が実装され、データベースシードスクリプトが追加されています。
### 変更点
| ファイル | 要約 |
| --- | --- |
| README.md | Googleログインの設定手順を削除し、開発環境用の簡易認証方法と`SESSION_SECRET`の生成方法を追加。seedコマンドの実行手順も更新。 |
| web/package.json | `seed`スクリプトを追加し、開発環境でのデータベースシードを実行する設定を含む。 |
| web/prisma/seed.ts | 開発環境でのみ実行されるユーザーシーディングスクリプトを追加。bcryptを使用してパスワードをハッシュ化し、Prismaを用いてデータベースに保存。 |
| web/app/routes/auth.login.tsx | ログイン機能を追加。zodを使用したバリデーションスキーマ、フォーム作成、エラーメッセージ表示、Google認証とユーザー名・パスワードによる認証処理を含む。 |
| web/app/types.ts | `SafeUser`型から`openAIApiKey`と`claudeApiKey`を除外。 |
| web/app/utils/auth.server.ts | bcryptjsとremix-auth-formのインポートを追加し、フォームベースの認証戦略を実装。不要なAPIキーを除外。 |
| web/prisma/migrations/20240721105034_/migration.sql, web/prisma/migrations/20240721115647_/migration.sql, web/prisma/migrations/20240721123812_/migration.sql | `users`テーブルに`password`列を追加・削除するためのSQL文を含む。 |
| web/prisma/schema.prisma | `User`モデルにオプショナルな`password`フィールドを追加。 | Uplevel your code reviews with CodeRabbit ProCodeRabbit ProIf you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects. |
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.
Files selected (10)
- README.md (2)
- web/app/routes/auth.login.tsx (2)
- web/app/types.ts (1)
- web/app/utils/auth.server.ts (3)
- web/package.json (1)
- web/prisma/migrations/20240721105034_/migration.sql (1)
- web/prisma/migrations/20240721115647_/migration.sql (1)
- web/prisma/migrations/20240721123812_/migration.sql (1)
- web/prisma/schema.prisma (1)
- web/prisma/seed.ts (1)
Review comments generated (15)
- Review: 6
- LGTM: 9
Tips
Chat with CodeRabbit Bot (@coderabbitai
)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitai
in a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignore
anywhere in the PR description to pause further reviews from the bot.
@@ -9,7 +9,11 @@ | |||
"dev": "remix vite:dev", | |||
"start": "remix-serve ./build/server/index.js", | |||
"typecheck": "tsc", | |||
"check": "bunx @biomejs/biome check --write ." | |||
"check": "bunx @biomejs/biome check --write .", | |||
"seed": "NODE_ENV=development prisma db seed" |
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.
@@ -23,7 +56,7 @@ const googleStrategy = new GoogleStrategy<SafeUser>( | |||
where: { email: profile.emails[0].value }, | |||
}); | |||
if (user) { | |||
const { geminiApiKey, ...safeUser } = user; | |||
const { password, geminiApiKey, openAIApiKey, claudeApiKey, ...safeUser } = user; |
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.
@@ -0,0 +1,2 @@ | |||
-- AlterTable | |||
ALTER TABLE "users" ADD COLUMN "password" TEXT; |
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.
password
カラムはユーザーのパスワードを保存するために使用されるため、セキュリティ上の理由から暗号化された形式で保存する必要があります。Prismaのマイグレーションファイルではなく、アプリケーションコード内でbcryptなどを使用してハッシュ化することが推奨されますが、ここではデータ型をTEXTからVARCHAR(255)に変更することを検討してください。
- ALTER TABLE "users" ADD COLUMN "password" TEXT;
+ ALTER TABLE "users" ADD COLUMN "password" VARCHAR(255);
@@ -0,0 +1,2 @@ | |||
-- AlterTable | |||
ALTER TABLE "users" ADD COLUMN "password" TEXT; |
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.
if (process.env.NODE_ENV !== 'development' && !process.env.ALLOW_SEEDING) { | ||
console.log('Seeding is only allowed in development environment') | ||
return |
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.
return | ||
} | ||
|
||
const hashedPassword = await bcrypt.hash('devpassword', 10) |
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.
Summary by CodeRabbit