fix(user): better regex and message for validate email

This commit is contained in:
Anhgelus Morhtuuzh 2025-08-14 21:27:44 +02:00
parent c1385df0f9
commit c45d8e3ffd
Signed by: anhgelus
GPG key ID: 617773CACE89052C

View file

@ -33,8 +33,8 @@ defmodule LearningPhoenix.Accounts.User do
changeset = changeset =
changeset changeset
|> validate_required([:email]) |> validate_required([:email])
|> validate_format(:email, ~r/^[^@,;\s]+@[^@,;\s]+$/, |> validate_format(:email, ~r/^[^@,;\s]+@[^@,;\s]+\.[^@,;\s]+$/,
message: "must have the @ sign and no spaces" message: "this is not a valid email address"
) )
|> validate_length(:email, max: 160) |> validate_length(:email, max: 160)