Fix authguard#1695
Conversation
|
Caution Review failedPull request was closed or merged during review 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 (5)
📝 WalkthroughWalkthroughReorganized route guards into a dedicated directory structure, introduced a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates Angular route-guarding to fix AuthGuard imports/placement and to prevent authenticated users from accessing auth-only routes (e.g., login/registration).
Changes:
- Move/update
AuthGuardimport usage tosrc/app/guards/auth.guard.tsand apply it to protected routes. - Introduce
noAuthGuardto redirect authenticated users away from/loginand/registration. - Update router config to apply
noAuthGuard(and adjust guard ordering on/login).
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/app/routes/password-change.routes.ts | Updates AuthGuard import path to the new guards location. |
| frontend/src/app/guards/no-auth.guard.ts | Adds a new functional guard that redirects logged-in users away from auth pages. |
| frontend/src/app/guards/auth.guard.ts | Adds a new AuthGuard implementation based on token_expiration. |
| frontend/src/app/guards/auth.guard.spec.ts | Adds an initial unit test scaffold for AuthGuard. |
| frontend/src/app/app-routing.module.ts | Applies new guard wiring for /login and /registration and updates AuthGuard import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { setupGuard } from './guards/setup.guard'; | ||
|
|
||
| const routes: Routes = [ | ||
| { path: '', redirectTo: '/connections-list', pathMatch: 'full' }, |
There was a problem hiding this comment.
The /loader route was removed from the router config, but AppComponent still sets redirect_uri to ${location.origin}/loader (frontend/src/app/app.component.ts:68). If this is used as an OAuth/SSO redirect, removing the route will cause a 404/broken login flow; either restore the /loader route or update the redirect URI to an existing route.
| { path: '', redirectTo: '/connections-list', pathMatch: 'full' }, | |
| { path: '', redirectTo: '/connections-list', pathMatch: 'full' }, | |
| { path: 'loader', redirectTo: '/login', pathMatch: 'full' }, |
Summary by CodeRabbit
New Features
Chores