Neilk1021 opened a new pull request, #7339:
URL: https://github.com/apache/texera/pull/7339

   ### What changes were proposed in this PR?
   
   This PR replaces the two ad-hoc login surfaces with one dedicated login page.
   
   Before, a visitor could sign in from either the local form embedded as a 
column in the **About** page, or the Google button sitting in the **dashboard 
navbar** — the latter wired directly into `DashboardComponent`, which 
subscribed to `SocialAuthService.authState`, exchanged the id token, and 
navigated as a side concern of rendering the app chrome. `AuthGuardService` and 
the 401 interceptor both had to redirect to `/about` because there was nowhere 
better to send anyone.
   
   After, there is a single `/login` page and everything points at it.
   
   **New**
   
   - `TexeraLoginComponent` (`frontend/src/app/hub/component/login/`) — a 
centred full-page card with tabbed local **Sign In** / **Sign Up** plus a 
`social-buttons` block for the Google button. The tabs render only when 
`localLogin` is enabled and the Google button only when `googleLogin` is 
enabled, so a deployment with one provider disabled gets a coherent page rather 
than a dead one. Adding another provider means one more button in that block, 
not another login surface. The component owns the Google `authState` 
subscription, the id-token exchange, and post-login navigation; it filters 
`null` out of `authState` because that subject is a `ReplaySubject` and logout 
pushes a stale `null` that would otherwise replay into a fresh subscription. It 
also keeps the previous form's behaviour of prefilling `defaultLocalUser` 
credentials in local dev.
   - `GuestGuardService` — the mirror of `AuthGuardService`. It keeps an 
already-signed-in user off `/login`, sending them to their `returnUrl` when one 
survived the round trip and to their workflows otherwise.
   - The `login` route is registered at the top level of 
`app-routing.module.ts`, a sibling of the `DashboardComponent` shell, so it 
renders in the root outlet without the navbar and sidebar.
   
   **Changed**
   
   - `AuthGuardService` and `UnauthorizedHttpInterceptor` now navigate to 
`LOGIN` instead of `ABOUT`; the existing `returnUrl` handling is unchanged.
   - `DashboardComponent` drops `SocialAuthService`, 
`GoogleSigninButtonModule`, and the `authState` login flow. Logged-out visitors 
get a **Sign in** link to `/login` in the navbar slot the user icon occupies 
once signed in, styled to read as an ng-zorro primary button.
   - `AboutComponent` is now static marketing copy — with the login form gone 
it has no auth state left to track, so `OnInit`, `UserService`, and the 
`isLogin$` subject were removed.
   
   **Removed**
   
   - `hub/component/about/local-login/` (component, template, styles, spec) and 
its `app.module.ts` declaration.
   
   <!-- TODO: attach before/after screenshots of the About page, the navbar, 
and the new /login page. -->
   
   ### Any related issues, documentation, discussions?
   
   Closes #7338
   
   The page layout and styling were designed in Figma first and transcribed 
into the implementation here.
   <!-- TODO: link the Figma design if it can be shared. -->
   
   ### How was this PR tested?
   
   New and updated Angular unit specs, run with the frontend unit suite:
   
   - `texera-login.component.spec.ts` (new, 19 cases) — `defaultLocalUser` 
prefill and the empty-config case; mode switching clearing the error message; 
the confirm-password validator firing only in sign-up mode; sign-in validation 
short-circuits for a blank username and a short password; `UserService.login` 
called with a trimmed username; navigation to `USER_WORKFLOW` and to 
`returnUrl`; login failure surfacing a message without navigating, including 
the fallback when the error carries none; registration rejecting a malformed 
email and mismatched passwords, calling `UserService.register`, and notifying 
on success; the Google `authState` path handing the id token to `googleLogin` 
and navigating, ignoring a `null` state, and notifying without navigating when 
the exchange fails.
   - `guest-guard.service.spec.ts` (new, 3 cases) — a logged-out visitor is 
allowed onto `/login`; a signed-in user is redirected to their workflows; a 
`returnUrl` is honoured when present.
   - `auth-guard.service.spec.ts` and 
`unauthorized-http-interceptor.service.spec.ts` — updated to assert the 
redirect target is `LOGIN`.
   - `dashboard.component.spec.ts` — asserts the navbar renders a sign-in link 
rather than a provider button when logged out, and neither when logged in.
   - `about.component.spec.ts` — trimmed to the static component, with a case 
asserting it no longer embeds a login form.
   
   Every spec covering the files this PR touches passes. Not covered by unit 
tests, and worth exercising by hand on review: the real Google sign-in round 
trip against a configured client id, and the page's appearance with 
`localLogin` / `googleLogin` toggled independently.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Co-authored. The design was produced in Figma by a human author and 
transcribed into this
   implementation with assistance from Claude Opus 4.8.
   
   Generated-by: Claude Opus 4.8
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to