AOSSIE-Org / AOSSIE-Org/DebateAI

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

オープン
#213 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
84
フォーク
198
平均マージ
2日 19時間
マージ済み PR(30日)
30

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。