AOSSIE-Org / AOSSIE-Org/DebateAI

[BUG]: Orphaned User Documents on Failed Email Send

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

説明

### Bug Description

When signup fails due to a SendVerificationEmail error, the user document is already persisted in MongoDB with isVerified: false. No rollback is performed, so the email address is permanently "taken" — the user can't log in (blocked by the !IsVerified check) and can't re-register ("User already exists")

### Steps to Reproduce

1 . Set invalid SMTP credentials.
2 . POST /api/auth/signup with a new email → returns HTTP 500.
3 . Repeat the same request → returns HTTP 400 "User already exists"

Actual Behavior
User is permanently locked out of that email address. Recovery requires manual deleteOne in MongoDB

Expected Behavior
If the email send fails, the user document should be rolled back so the user can re-register freely

### Logs and Screenshots

Image

Terminal Log :

[GIN] 2026/09/13 - 14:08:37 | 204 | 984.3µs | ::1 | OPTIONS "/signup"
[GIN] 2026/09/13 - 14:08:41 | 500 | 3.9518977s | ::1 | POST "/signup"

### Environment Details

- Component: backend/controllers/auth.go — SignUp() — Lines 194–209
- Database: MongoDB
- Mail: SMTP (Gmail)
- Framework: Go / Gin

### Impact

High - Major feature is broken

### Code of Conduct

- [x] I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and will post updates there
- [x] I have searched existing issues to avoid duplicates

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

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

調査の方向性

Start in backend/controllers/auth.go at SignUp() around lines 194–209, then reproduce the failure with invalid SMTP credentials and inspect whether the MongoDB user document remains. Done means a failed SendVerificationEmail leaves no unusable user record, and repeating POST /api/auth/signup with the same email can proceed without "User already exists".

索引モデルが issue の本文から書いたものです。

評価

技術スタック
go, mongodb
領域
authentication, backend, databases
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
76/100

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

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