Conversation
📝 WalkthroughWalkthroughThe change adds dedicated Google and Facebook login URLs end-to-end: new hosting options, two URL properties on the User model, the URLs included in the API meta payload, added to frontend app state, and used directly by the login component to render social login links. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Browser
participant EditorApp as Editor App (Login Component)
participant API as API (StateController)
participant User as UserModel / Hosting
Browser->>EditorApp: load login page
EditorApp->>API: GET /state/meta
API->>User: read hosting data (GOOGLE_LOGIN, FACEBOOK_LOGIN)
User-->>API: return google_login_url, facebook_login_url
API-->>EditorApp: meta { googleLoginUrl, facebookLoginUrl, ... }
EditorApp-->>Browser: render login UI with direct social links
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@editor/src/app/app-state/app.state.ts`:
- Around line 39-40: ResetAppStateAction currently preserves forgotPasswordUrl
during state resets but omits the newly added googleLoginUrl and
facebookLoginUrl, causing them to be cleared; update the ResetAppStateAction
implementation to also copy googleLoginUrl and facebookLoginUrl from the current
state (just like forgotPasswordUrl) into the reset state so social login URLs
loaded from metadata persist across resets—look for ResetAppStateAction and the
state properties googleLoginUrl, facebookLoginUrl, and forgotPasswordUrl to
apply the change.
🧹 Nitpick comments (2)
editor/src/app/login/login.component.ts (1)
31-50: Consider conditionally rendering each social login button based on URL availability.The social login buttons are rendered when
isBertaHostingis true, but there's no check for whethergoogleLoginUrlorfacebookLoginUrlare actually configured. If only one provider is set up, or if the metadata hasn't loaded yet, one or both buttons could render with invalid empty-base URLs (e.g.,?remote_redirect=...).Proposed template change
`@if` (appState.isBertaHosting) { <div class="form-group social-login"> - <a + `@if` (appState.facebookLoginUrl) { + <a href="{{ appState.facebookLoginUrl }}?remote_redirect={{ appState.authenticateUrl }}" class="button facebook" - > + > <bt-icon-facebook></bt-icon-facebook> <p>Log in with Facebook</p></a - > - <a + > + } + `@if` (appState.googleLoginUrl) { + <a href="{{ appState.googleLoginUrl }}?remote_redirect={{ appState.authenticateUrl }}" class="button google" - > + > <bt-icon-google></bt-icon-google> <p>Sign in with Google</p></a - > - <p>or</p> + > + } + `@if` (appState.facebookLoginUrl || appState.googleLoginUrl) { + <p>or</p> + } </div> }_api_app/app/User/UserModel.php (1)
22-25: Consider adding type declarations to the new properties.While the existing properties in this class lack type declarations, the coding guidelines recommend using appropriate PHP type hints. Since
getHostingData()can returnnull, these should be typed as nullable strings.Proposed type hints
- public $google_login_url; + public ?string $google_login_url; - public $facebook_login_url; + public ?string $facebook_login_url;
Summary by CodeRabbit