AOSSIE-Org / AOSSIE-Org/DebateAI

Issue: Fix Signup Flow (CORS Configuration & Error Handling)

Aperta
#213 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
84
Fork
198
Merge medio
2g 19h
PR unite (30g)
30

Descrizione

### Proposal: Improve Signup Reliability & Error Feedback

**Description**
The current signup flow experiences intermittent friction during local development due to strict network policies and opaque error handling. When requests fail validation (e.g., "User already exists"), the application currently suppresses the specific reason, leading to a generic "Signup failed" state. Additionally, the backend configuration can be overly restrictive regarding origin resolution (`localhost` vs `127.0.0.1`), potentially hindering seamless connectivity.

**Proposed Changes**

#### 1. Backend Improvements (`main.go`)
* **Broaden CORS Origin Support:** Update the `AllowOrigins` list to include `http://127.0.0.1:5173` alongside `localhost`.
* *Benefit:* This ensures more robust connectivity by accommodating browsers that resolve local addresses to the loopback IP, reducing the likelihood of `403 Forbidden` network rejections.
* **Standardize Header Acceptance:** Add `Accept` and `X-Requested-With` to the `AllowHeaders` configuration.
* *Benefit:* This aligns the backend with standard browser fetch behaviors, preventing preflight failures caused by strict header whitelisting.

#### 2. Frontend Experience Enhancements (`authContext.tsx`)
* **Refine Error Parsing Logic:** Update the `signup` function to prioritize reading `data.error` from the response before falling back to `data.message`.
* *Benefit:* This exposes specific validation feedback (e.g., "Password too short", "User already exists") directly to the user, significantly improving the troubleshooting experience compared to the current generic error message.

I have already made the required changes that will make onboarding for new developers easier, and am ready to create a PR.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.