Description
When adding emails for a user under Settings -> Account -> Manage Email Addresses
, Gitea 1.12.1 applies an email validation. If the address given doesn't satisfy gitea, it issues
gitea/options/locale/locale_en-US.ini
Line 417 in 3d6cb25
It seems like part of the validation is to require a .
in the domain, so for example johndoe@homepc
will be considered "invalid" while johndoe@homepc.local
will be accepted.
I don't think it makes sense for gitea to validate emails at this point. AFAIK these emails serve two purposes:
- Send email notifications
- Associate the user with the emails in git histories
Git 2.33.0 considers johndoe@homepc
a valid email and does not complain if commits are signed with it. When such commits are pushed to gitea, gitea then displays the author as johndoe
with no way of associating the actual gitea user with this. Since a git host like gitea should fully support all repositories produced by git, this seems to me like a bug with respect to point 2.
If we allow "invalid" emails to be added to the profile, then occasionally this might break point 1. There is anyhow no way to guarantee that sending emails won't occasionally fail, so letting users enter "invalid" emails does not actually introduce any new corner cases. Users can already enter invalid emails if they really want, the validation just requires the email to be invalid while conforming to a regex, so no problem is being solved here while the user is inconvenienced. That said, if validation is seen as necessary, perhaps emails could be validated not when they are being added, but when notifications are enabled for them.