MDeLuise / plant-it

🪴 Self-hosted, open source gardening companion app
https://plant-it.org
GNU General Public License v3.0
688 stars 25 forks source link

Valid Email Regex should accept all TLDs #274

Closed RamonAbudAlcala closed 3 months ago

RamonAbudAlcala commented 3 months ago

Avoid duplicated bug reports

Description

I just discovered that the regex to check for valid emails only accepts TLDs for up to 4 characters long.

These days there are TLDs of all sorts of sizes. I have not checked for which one is the longest but, for example: .photography or .green are more than 4 characters long.

I'd recommend to allow for any size of tld, as this also allows for the TLD .local

I have a purely local email server, with a custom TLD with more than 4 characters, used to handle home server and home user notifications. That is how I came across this issue.

This is the file https://github.com/MDeLuise/plant-it/blob/276077966009381ae22fa62f6cb9c4d75f1b9360/frontend/lib/signup.dart#L77

I suggest to replace line 77 with the one below, although other solutions might exist. r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,}$',

Local environment

I am running the latest docker version.

I was testing it with the default environment variables found on the docs.

github-actions[bot] commented 3 months ago

Hi @RamonAbudAlcala,

This task has been completed and will be implemented in the next project release. Thank you for your contribution!

If you have any further questions or updates regarding this task, feel free to leave a comment below.

RamonAbudAlcala commented 2 months ago

Hi @MDeLuise ! Thanks for this. I was just trying to deploy again today and it seems that I still have the same problem.

I may have found the culplrit, another place where the regex appears! Line 41 of this file. frontend/lib/more/edit_profile.dart

I have the latest version of the app (0.7.5 on Fdroid) and the latest version of the docker container (0.8.0).

MDeLuise commented 1 month ago

Hi @RamonAbudAlcala, Thanks for pointing this out and for identifying the additional instance of the wrong regex! I’m gonna implement a fix for this, and it will be included in the next release.