Conversation
- Introduced `guestGuard` to restrict access to the login page for authenticated users. - Updated `app.routes.ts` to apply `guestGuard` to the login route.
guestGuard to secure login route for unauthenticated users
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
User description
guestGuardto restrict access to the login page for authenticated users.app.routes.tsto applyguestGuardto the login route.PR Type
Enhancement
Description
Introduce
guestGuardto block authenticated usersApply guard on
/loginroute usingcanActivateDiagram Walkthrough
flowchart LR A["Login Route"] -- "canActivate guestGuard" --> B{"Authenticated?"} B -- "true" --> C["Redirect to Home"] B -- "false" --> D["Render Login"]File Walkthrough
app.routes.ts
Apply guestGuard to login routefrontend/src/app/app.routes.ts
guestGuardfromguest.guard.tscanActivate: [guestGuard]to login routeguest.guard.ts
Implement guestGuard logicfrontend/src/app/guest.guard.ts
guestGuardfunction fileAuthServiceandRouterdependencies