Skip to content

Remote social login route changes#622

Open
uldisrudzitis wants to merge 2 commits intomasterfrom
remote-social-login-route-change
Open

Remote social login route changes#622
uldisrudzitis wants to merge 2 commits intomasterfrom
remote-social-login-route-change

Conversation

@uldisrudzitis
Copy link
Collaborator

@uldisrudzitis uldisrudzitis commented Feb 3, 2026

Summary by CodeRabbit

  • New Features
    • Added dedicated Google and Facebook login buttons so each provider links directly to its own URL (no shared provider parameter).
    • Login URLs can be configured via hosting settings, allowing independent enablement or disabling of Google and Facebook logins.

@uldisrudzitis uldisrudzitis self-assigned this Feb 3, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Backend: hosting & user model
_api_app/app/User/UserModel.php, engine/inc.hosting.php
Added google_login_url and facebook_login_url properties on UserModel, initialized from hosting data; added GOOGLE_LOGIN and FACEBOOK_LOGIN entries to hosting options.
Backend: API response
_api_app/app/Http/Controllers/StateController.php
Included googleLoginUrl and facebookLoginUrl in the meta payload returned by getMeta().
Frontend: application state
editor/src/app/app-state/app-state.interface.ts, editor/src/app/app-state/app.state.ts
Extended AppStateModel with googleLoginUrl and facebookLoginUrl; initialized and preserved them in default/reset state.
Frontend: login UI
editor/src/app/login/login.component.ts
Reworked social-login rendering to check and link each provider URL individually (appState.googleLoginUrl, appState.facebookLoginUrl) and removed provider query param composition.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through config, fields in tow,
Google and Facebook now ready to go,
From hosting to state, then shown in the UI,
Click a button — up the social fly! ✨🐇

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Remote social login route changes' directly relates to the core changes: adding remote social login URLs (Google and Facebook) throughout the codebase for authentication routing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remote-social-login-route-change

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 isBertaHosting is true, but there's no check for whether googleLoginUrl or facebookLoginUrl are 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 return null, 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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant