Component Name: redirectHomePage¶
Last Updated: 2025-09-29 Source Code: https://bitbucket.org/i2cinc/i2c.salesforce.metadata/src/STAGING/force-app/main/default/lwc/redirectHomePage
API Name: c-redirectHomePage Type: Service Component Target: Not exposed
Business Purpose¶
Automatically redirects users from the site home page based on their authentication status. Guest users are redirected to /login, while authenticated users are redirected to /my-account. Prevents guests from accessing the default home page.
User Interface¶
No visible UI - automatic redirect
Component Structure¶
Files¶
redirectHomePage.html- Empty templateredirectHomePage.js- Controller (31 lines)redirectHomePage.js-meta.xml- Not exposed
JavaScript Controller¶
Properties¶
isGuestUser¶
- Stores result of
@salesforce/user/isGuest
loginUrl¶
- Constructed from basePath
Lifecycle¶
connectedCallback()¶
- Checks if user is guest
- Gets current URL path
- Redirects based on user status:
- Guest: Redirects to /aanpstoredc/login
- Authenticated: Redirects to /aanpstoredc/my-account
Dependencies¶
Salesforce User¶
@salesforce/user/isGuest: Guest status check@salesforce/community/basePath: Base path
Usage Examples¶
⚠️ Pre-Go-Live Concerns¶
CRITICAL¶
- Typo on line 21:
this.isGuestUseshould bethis.isGuestUser- causes redirect logic to fail!
HIGH¶
- Hardcoded paths: "/aanpstoredc" paths hardcoded (lines 17-19) - should use basePath or custom metadata
- Console.log in production: Line 11
- No loading indicator: User sees blank page during redirect
MEDIUM¶
- Redirect only on exact path match: Only redirects from "/aanpstoredc" or "/aanpstoredc?" - won't redirect from "/aanpstoredc/"
LOW¶
- Uses window.location.replace: Prevents back button navigation (may be intentional)
Maintenance Notes¶
Complexity: Low Key Notes: - CRITICAL BUG: Typo on line 21 breaks redirect logic - Component should be placed on site home page - Hardcoded paths need to be made configurable - Prevents guests from accessing home page - Uses replace() to prevent back navigation
Browser Compatibility: - Standard browser support