This commit is contained in:
byte[] 2020-11-30 23:46:51 -05:00
parent ad1963e57c
commit da17726fc5

View file

@ -161,7 +161,9 @@ defmodule Philomena.Users.User do
defp validate_email(changeset) do defp validate_email(changeset) do
changeset changeset
|> validate_required([:email]) |> validate_required([:email])
|> validate_format(:email, ~r/^[^\s]+@[^\s]+\.[^\s]+$/, message: "must be valid (e.g., user@example.com)") |> validate_format(:email, ~r/^[^\s]+@[^\s]+\.[^\s]+$/,
message: "must be valid (e.g., user@example.com)"
)
|> validate_length(:email, max: 160) |> validate_length(:email, max: 160)
|> unsafe_validate_unique(:email, Philomena.Repo) |> unsafe_validate_unique(:email, Philomena.Repo)
end end