mirror of
https://github.com/go-gitea/gitea.git
synced 2026-12-04 15:54:57 +00:00
The forgot-password page answers an unknown email with the "reset mail sent" confirmation, which is the right call for not revealing accounts. But for an existing local account, a second request inside the 180 second `MailResendLimit_` window sets `ResendLimited`, and because `IsResetRequest` is already set the template renders the reset form again instead of the confirmation. So an anonymous client can send an address twice and tell from the second response whether it belongs to an account. It needs the mail service enabled, nothing else. This makes the resend-limited branch set the same `IsResetSent` / `ResetPwdCodeLives` data as the normal and unknown-user paths. The resend limit still holds, so no extra mail goes out. It's the same kind of difference #36002 removed from the login errors (#35984), just on the reset page. Tested on a local instance with SQLite and a dummy mailer: on v28.4.0 and on main the repeat request showed the form while an unknown address showed the confirmation; with this change all of them show the confirmation. The `routers/web/auth` package tests pass on main and `release/v28` with the change. It applies to `release/v28` too if you want it backported. I used AI tools to help find this and draft the change; I've gone over the diff and the code path myself. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>