Skip to content

Aditya Dhayapulay - Require explicit Community Portal login access - #5789

Open
adit24dhaya wants to merge 2 commits into
developmentfrom
fix/phase3-secondary-login
Open

adit24dhaya wants to merge 2 commits into
developmentfrom
fix/phase3-secondary-login

Conversation

@adit24dhaya

@adit24dhaya adit24dhaya commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Description

The Community Portal gate showed protected UI when a main token had no access object. The login form silently ignored denied-account and server/network errors. Require explicit secondary access and show clear denial/retry feedback.

Original task request

HGN Phase III: Social Architecture — Deliverable 0, page 6. Original requirements: check that the person is active in Main and require secondary login with current credentials. Found during Aditya's assigned Phase 3 general-functionality E2E testing task; this does not complete the entire 60-hour assignment.

Phase3-document-title

Phase3-original-access

Related PRS (if any):

Backend: OneCommunityGlobal/HGNRest#2475. Test both branches together; merge backend first.

Main changes explained:

  • Require canAccessBMPortal === true; missing/false/non-boolean access returns to secondary login.
  • Show email/password denial messages for 401/403 as well as validation errors, and generic retry feedback for other failures.
  • Check HTTP status 200 and a returned token instead of optional status text.
  • Cancel the pending fallback redirect when the login form unmounts. A controlled-clock regression fails on the preceding commit and passes after cleanup.

How to test:

  1. Run both branches with Node 20, disposable data and synthetic accounts.
  2. Open a protected portal page signed out: main login is required. With a main token but no secondary access, including missing access data, require secondary login.
  3. Matching active-user credentials return to the requested page. Wrong credentials stay on the form with the relevant message. Accounts deactivated/deleted after main-token issuance are denied visibly.
  4. Simulate a server/network failure: show retry feedback. Cancel logout stays signed in; confirmed logout removes the token. Reload/direct links after logout require main login. Expired stored tokens are rejected by actual auth startup.
  5. Run npx vitest run src/components/CommunityPortal/Login/__tests__/CPLogin.test.jsx src/components/common/CPDashboard/CPProtectedRoute/CPProtectedRoute.test.jsx src/utils/__tests__/authInit.test.js src/actions/__tests__/authActions.js.test.js.

Validation: 35 frontend tests, 16 Chromium cases at 390/1280px, production build, JS lint and commit hooks pass. The before-fix browser run reproduced missing-access and inactive-account entry; all four failing cases now pass. The paired real-controller/disposable-MongoDB checks also pass all seven API cases.

Screenshots or videos of changes:

after-inactive-1280

after-inactive-390

Note:

The harness uses actual auth startup/actions/reducer, portal login/gate and logout, plus the real secondary controller and disposable MongoDB. Main-token issuance and protected destination content are fixture-only. This validates the login/logout slice, not all role permissions or full deployed E2E. No shared writes, real notifications or manual deployments. Week 6 media is prepared locally, not uploaded to Dropbox.

Close the secondary-login gate when access data is missing, display denied-account and retry messages, and use the HTTP status instead of its optional text. Covers findings from the Phase 3 access audit.
@netlify

netlify Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit a36bd28
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/6aed65327544b2ce110a858d
😎 Deploy Preview https://deploy-preview-5789--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Clear the fallback redirect on unmount so it cannot navigate after the form closes or leak into the next session. A controlled-clock regression fails on the previous commit and passes with cleanup.
@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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