feat: 添加 Google OAuth 登录支持 - #4118
Conversation
- 新增 Google OAuth 提供者实现,包括令牌交换和用户信息获取 - 在用户模型中添加 GoogleId 字段及相关查询方法 - 添加系统设置页面用于配置 Google OAuth 客户端信息 - 在前端登录和注册页面添加 Google 登录按钮 - 在用户状态更新时同步 GoogleId 字段
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
WalkthroughThis pull request implements Google OAuth provider support end-to-end: adds Google provider ID and settings to backend models and configuration, creates a Google OAuth provider with token exchange and user info flows, updates controllers to expose Google OAuth status and handle provider bindings, and adds login/registration/configuration UI components on the frontend. Changes
Sequence DiagramsequenceDiagram
participant User as User (Browser)
participant Frontend as Frontend (LoginForm)
participant Google as Google OAuth
participant Backend as Backend (Controller)
participant DB as Database
User->>Frontend: Click "Login with Google"
Frontend->>Frontend: handleGoogleClick: prepare state
Frontend->>Google: Redirect to authorization endpoint<br/>(with client_id, redirect_uri, scope)
Google->>User: Show consent screen
User->>Google: Authorize
Google->>Frontend: Redirect with authorization code
Frontend->>Backend: POST /oauth/google/exchange<br/>(code from redirect)
Backend->>Google: POST token endpoint<br/>(code + client credentials)
Google->>Backend: Return access token
Backend->>Google: GET userinfo endpoint<br/>(with access token)
Google->>Backend: Return user profile (sub, email, name)
Backend->>DB: Query/create user with GoogleId
DB->>Backend: Return user
Backend->>User: Login session established
Frontend->>User: Redirect to dashboard
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
现有自定义oauth登录已经可以完成google登录流程,不考虑增加 |
Summary by CodeRabbit