Skip to content

Relax email validation #17029

Closed
Closed
@metov

Description

@metov

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

email_error = ` is not a valid email address.`
.

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:

  1. Send email notifications
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions