AOSSIE-Org / AOSSIE-Org/DebateAI

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

Ouverte
#213 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
84
Forks
198
Merge moyen
2 j 19 h
PR mergées (30 j)
30

Description

### 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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.